【发布时间】:2017-12-22 00:04:27
【问题描述】:
我正在尝试使用 kivy 和 TabeedPanel 在 python 中制作 GUI。放置标签、TextInput、按钮的确切位置会出现一些问题。我无法完全放置多个标签 TextInput。这就是我在代码中注释的原因。我也尝试了 GridLayout,但无法准确安排。 你能帮助我吗?提前致谢。
from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem
from kivy.lang import Builder
from kivy.uix.checkbox import CheckBox
from kivy.uix.button import Button
from kivy.app import App
from kivy.uix.textinput import TextInput
import json
Builder.load_string("""
<Test>:
do_default_tab: False
TabbedPanelItem:
text: 'page1'
BoxLayout:
Label:
text: 'label'
TextInput:
text: 'TextInput'
CheckBox:
text: 'CheckBox'
Button:
text: 'save'
#BoxLayout:
# orientation: 'vertical'
# BoxLayout:
# orientation: 'horizontal'
# Label:
# text: 'label'
TabbedPanelItem:
text: 'page2'
BoxLayout:
Label:
text: 'number1'
#TextInput:
# text: 'TextInput'
Label:
text: 'number2'
# TextInput:
# text: 'TextInput'
Button:
text: 'button'
""")
class Test(TabbedPanel):
pass
class MyApp(App):
def build(self):
test = Test()
return test
if __name__ == '__main__':
MyApp().run()
【问题讨论】:
标签: python user-interface tabs kivy textinput