Python Kivy无法在Windows上的ActionBar下拉菜单中单击文本输入(无法单击进入TextInput)

时间:2018-03-03 19:19:22

标签: python-3.x kivy kivy-language

我使用ActionBar设置了一个带有一系列按钮和下拉(溢出)的简单菜单。菜单中下拉部分的名称为“设置”。当我点击“设置”时,会出现一个下拉列表,显示它所拥有的三个TextInput小部件。

当我尝试点击(或进入)任何TextInput时,下拉菜单关闭。更糟糕的是,这个问题只发生在Windows操作系统上,它在Linux上运行良好。

任何人都可以解释为什么我无法点击(或进入)TextInputs?

from kivy.uix.textinput import TextInput
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.actionbar import ActionItem

class MainScreen(Screen):
    def __init__(self, **kwargs):
        super(MainScreen, self).__init__(**kwargs)


class ActionInput(TextInput, ActionItem):
    pass


class mScreenManager(ScreenManager):
    pass

root_widget = Builder.load_string('''
mScreenManager:
    MainScreen:
<MainScreen>:  
    ActionBar:
        pos_hint: {'top':1}
        ActionView:
            use_separator: True
            ActionPrevious:
                title: 'Menu'
                with_previous: False
           ActionOverflow:
           ActionButton:
               id: b_1
               text: 'b_1'
               on_release: 
           ActionButton:
               id: b_2
               text: 'b_2'
               on_release:
           ActionButton:
               id: b_3
               text: 'b_3'
               on_release:
           ActionButton:
               id: b_4
               text: 'b_4'
               on_release:
           ActionButton:
               id: b_5
               text: 'b_5'
           ActionButton:
               id: b_6
               text: 'b_6'
               on_release:
           ActionGroup:
               text: 'Settings'
               mode: 'spinner'
               ActionInput:
                    id: t_input_1
                    hint_text: "Can't click"
                    multiline: False
                    on_text_validate: 
               ActionInput:
                   id: t_input_2
                   hint_text: "can't click"
                   multiline: False
                   on_text_validate:
               ActionInput:
                   id: t_input_3
                   hint_text: "Can't click"
                   multiline: False
                   on_text_validate:
''')

class TestApp(App):
    def build(self):
        self.title = 'Example App'
        return root_widget


if __name__ == '__main__':
    TestApp().run()

0 个答案:

没有答案