做一个古怪的教程并idk我的代码有什么问题。我的文字“名字”没有显示,但其他人的确喜欢“姓氏”和“电子邮件”
我试图问一个朋友,他说他没发现任何问题。 这是我要播放的视频。他的作品,跳到5:30看。 https://www.youtube.com/watch?v=fGWHQA3LhJ8
代码:
import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
class MyGrid(GridLayout):
def __init__(self, **kwargs):
super(MyGrid, self).__init__(**kwargs)
self.cols = 1
self.inside = GridLayout()
self.inside.cols = 2
self.inside.add_widget(Label(text="First Name: "))
self.name = TextInput(multiline=False)
self.inside.add_widget(self.name)
self.inside.add_widget(Label(text="Last Name: "))
self.last_name = TextInput(multiline=False)
self.inside.add_widget(self.last_name)
self.inside.add_widget(Label(text="Email: "))
self.email = TextInput(multiline=False)
self.inside.add_widget(self.email)
self.add_widget(self.inside)
self.submit = Button(text="Submit", font_size=40)
self.add_widget(self.submit)
class MyApp(App):
def build(self):
return MyGrid()
if __name__ == "__main__":
MyApp().run()
它应该显示First Name
: