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
''')