【发布时间】:2017-12-04 06:54:51
【问题描述】:
我有两个文件 test.py 和 test.kv。
我想通过按回车键从一个文本框移动到另一个文本框。这如何实现?
test.py
from kivy.uix.screenmanager import Screen
from kivy.app import App
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.properties import ObjectProperty
Window.size = (500, 330)
class TestScreen(Screen):
popup = ObjectProperty(None)
class Test(App):
def build(self):
self.root = Builder.load_file('test.kv')
return self.root
if __name__ == '__main__':
Test().run()
test.kv
#:kivy 1.10.0
TestScreen:
GridLayout:
cols: 2
padding : 30,30
spacing: 10, 10
row_default_height: '40dp'
Label:
text: 'Name'
TextInput:
id: name
Label:
text: 'Class'
TextInput:
id: clas
Button:
text: 'Ok'
Button:
text: 'Cancel'
【问题讨论】:
-
请列出迄今为止您尝试过的所有步骤。
标签: python python-3.x python-2.7 kivy kivy-language