效果图:
from kivy.app import App from kivy.uix.gridlayout import GridLayout from kivy.uix.label import Label from kivy.uix.textinput import TextInput class MyGride(GridLayout): def __init__(self, **kwargs): super(MyGride, self).__init__(**kwargs) self.cols=2 self.mylayout=GridLayout(cols=2) self.mylayout.add_widget(Label(text='First Name AA')) self.mylayout.add_widget(TextInput(multiline=False)) self.mylayout.add_widget(Label(text='First Name BB')) self.mylayout.add_widget(TextInput(multiline=False)) self.mylayout.add_widget(Label(text='First Name CC')) self.mylayout.add_widget(TextInput(multiline=False)) self.add_widget(self.mylayout) self.firstname = TextInput(multiline=False) self.add_widget(self.firstname) self.add_widget(Label(text='Last Name')) self.lastname=TextInput(multiline=False) self.add_widget(self.lastname) self.add_widget(Label(text='Email')) self.email=TextInput(multiline=False) self.add_widget(self.email) class MyApp(App): def build(self): return MyGride() if __name__ == '__main__': MyApp().run()