0
不好意思打扰你。我最近开始在基维开发,我试图在窗口中显示一个可滚动的文本文件。文本来自.txt文件,并使用标签的id将从文件中获得的字符串放入Label中的文本字段中。 我遇到的问题是,如果kivy文档中明确指出标签没有行限制(默认情况下),当我传递一定数量的文本时,文本会以黑色显示,如附图所示。在添加一行到.txt之前,文本可以被正确读取,但是在添加行之后问题就开始了。Scrollabel标签在文本中是有限的吗?
这里是我的代码,我有被称为 “这份执行”烦恼标签的ID。有人可以告诉我,如果我的标签配置或其他东西有一些错误吗?
from kivy.lang import Builder
Builder.load_string('''
<RootWidget>:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
pos: self.pos
size: self.size
color: (0, 0, 0, 1.0)
background_color: (255, 255, 255, 1.0)
carousel: carousel
Carousel:
on_index: root.on_index(*args)
id: carousel
ignore_perpendicular_swipes: True
FloatLayout:
id: tab1
Label:
id: identification
text: ''
markup: True
color: (0, 0, 0, 1.0)
halign: 'left'
valign: 'top'
font_size: '18pt'
x: 100
y: -80
opacity: 0
Image:
id: avatar
source: 'assets/avatar.png'
keep_ratio: True
size_hint_x: 0.3
x: 60
y: -70
opacity: 0
Image:
id: banner
source: 'assets/banner.png'
keep_ratio: True
size_hint_x: 1
x: 0
y: 160
opacity: 0
Image:
id: lock
source: 'assets/lock.png'
FloatLayout:
id: tab2
Label:
id: asunto
text: 'Asunto: [b] Expdte. 234/98634987/54[/b]'
markup: True
color: (0, 0, 0, 1.0)
halign: 'left'
valign: 'top'
font_size: '18pt'
x: 40
y: 170
opacity: 0
Image:
id: votacion
size_hint_x: 0.2
x: 20
y: 80
opacity: 1
Label:
id: voto_text
text: '[b]VOTO POSITIVO[/b]'
markup: True
color: (0, 0, 0, 1.0)
halign: 'left'
valign: 'top'
font_size: '40pt'
y: 90
x: 40
opacity: 1
Image:
id: biometric_icon
source: 'assets/biometric.png'
keep_ratio: False
size_hint_x: 0.2
y: -90
x: 320
opacity: 1
Label:
id: confirm_label
text: 'CONFIRMACI\xc3\x93N BIOM\xc3\x89TRICA'
markup: True
color: (0, 0, 0, 1.0)
halign: 'center'
valign: 'top'
font_size: '10pt'
y: -190
x: 00
opacity: 1
FloatLayout:
id: tab3
ScrollView:
on_scroll_start: print("arranque")
on_scroll_move: print("me muevo")
on_scroll_stop: print("pare")
Label:
id: documento
text_size:700, None
size_hint_y: None
height: self.texture_size[1]
color: (0, 0, 0, 1.0)
Label:
id: debugger
text: ''
color: (0, 0, 0, 1.0)
halign: 'left'
valign: 'top'
width: 200
''')