首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Kivy中屏幕外文本输入的清晰度

Kivy中屏幕外文本输入的清晰度
EN

Stack Overflow用户
提问于 2018-06-03 03:59:29
回答 1查看 1.5K关注 0票数 1

我试图清除textinput中的文本,但在访问texinput属性时遇到问题。我想清除文本(entry.text)后,当我释放按钮接受并离开InputScreen。我找到了get_screen()来设置属性,但我现在不知道如何将它与kivy-language一起使用

代码语言:javascript
复制
ScreenManagement:
    id: screen_manager
    transition: FadeTransition()
    MainScreen:
        id: main_screen
        name: "main"
        manager: screen_manager
        numberSet1: input_screen.number1
        numberSet2: input_screen.number2
        numberSet3: input_screen.number3
    InputScreen:
        id: input_screen
        name: "input"
        manager: screen_manager
        textIdToReturn: main_screen.textName

<InputScreen>:

    NawiButton:
        tempNumber: key_board.entryText
        pos: root.width - 100 - 0.25 * root.width, 10
        text: "Acceppt"
        on_release: root.saveValue(root.textIdToReturn, self.tempNumber)
        background_normal: ''
        background_color: .3, 1, .4, .85

    KeyBoardGridLayout:
        id: key_board
        name: "KeyBoard"

<KeyBoardGridLayout>:
    rows: 5
    padding: [100, 10, 100, 100]
    spacing: 3
    entryText: entry.text

    BoxLayout:
        TextInput:
            id: entry
            font_size: 45
            multiline: False
            on_text: root.update_padding(args[0])
            padding_x: self.width/2


    BoxLayout:
        spacing: 3
        KeyBoardButton:
            text: "1"
            on_press: entry.text = root.addText(entry.text, self.text)
        KeyBoardButton:
            text: "2"
            on_press: entry.text = root.addText(entry.text, self.text)
        KeyBoardButton:
            text: "3"
            on_press: entry.text = root.addText(entry.text, self.text)

MainScreen类,但我认为这并不重要:

代码语言:javascript
复制
<MainScreen>:
        BoxLayout:
            orientation: "vertical"
            spacing: 50
            padding: [300, 50, 300, 50]

            Button:
                text: root.numberSet1
                id: textNum1
                name: textNum1
                font_size: 45
                on_release:
                    root.touch("textNum1")
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50660685

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档