【问题标题】:Scrollabel label is limited in text?可滚动标签仅限于文本?
【发布时间】:2017-08-31 20:04:20
【问题描述】:

很抱歉打扰您。我最近开始在 Kivy 中进行开发,我试图在窗口中显示一个可滚动的文本文件。文本来自一个 .txt 文件,并使用标签的 id 将从文件中获取的字符串放入标签中的文本字段中。 我遇到的问题是,尽管 kivy 文档明确指出标签没有行数限制(默认情况下),但当我通过某个数字时,文本开始全部显示为黑色,因为我将附上图片。在向 .txt 中再添加一行之前,可以很好地阅读文本,但是在添加该行之后,问题就开始了。

After adding the line

Before adding the line

这是我的代码,我遇到问题的标签的 ID 称为“documento”。有人可以告诉我我的标签配置是否有错误或其他问题吗?

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



 ''')

【问题讨论】:

    标签: label scrollable kivy-language


    【解决方案1】:

    我继续寻找解决这个问题的方法,结果发现我的 gpu 对渲染文本有限制,所以问题就是这样。所以总结和帮助遇到同样问题的每个人,限制不是来自kivy而是来自gpu

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-04
      • 1970-01-01
      • 2017-09-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多