首页 > 解决方案 > Kivy TextInput 文本溢出。TextInput 视口外的光标

问题描述

最后一个字母溢出

我正在使用 Kivy 1.10.1。我添加了一个文本输入(多行 = False)。上面输入的句子是“This is a long sentence being typed into Kivy”。所有的字母都输入了。但最后一个字母 - “y”在文本输入之外。我试过改变填充大小、边框大小和改变文本输入本身的大小。我不知道我做错了什么还是图书馆的错误。

编辑:(我应该在这里添加小部件代码)

text_input: input_text_field

canvas:
    Color:
        rgba: self.background_color_intensity_red, self.background_color_intensity_green, self.background_color_intensity_blue, 1
    Rectangle:
        size: 396, 768
        pos: self.pos
        source: "sprites/phone.png"

BoxLayout:
    size: 354, 598
    pos: 21, 96
    orientation: 'vertical'

    BoxLayout:
        size_hint: 1, 0.1
        pos: root.pos
        orientation: 'horizontal'

        Image:
            size_hint: 0.15, 1
            source: "sprites/profile_pic.png"

        TextInput:
            id: input_text_field
            size_hint: 0.85, 0.5
            pos_hint: {'top': 0.75}
            background_color: 1,1,1,1
            border: (20, 20, 20, 20)
            multiline: False
            halign: 'center'
            focus: True
            on_text_validate: self.parent.parent.parent.on_text_input()

    BoxLayout:
        size_hint: 1, 0.9
        pos: root.pos
        orientation: 'vertical'

谢谢你。

标签: kivy

解决方案


推荐阅读