在编写代码以显示带有文本“名称”的窗口和对话框之后,我没有出现任何错误。但是对我来说窗口不显示。而且我没有任何错误。有人对此有任何想法吗?
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
class MyGrid(GridLayout):
def __init__(self, **kwargs):
super(MyGrid, self).__init__(**kwargs)
self.cols = 2
self.add_widget(Label(text="name"))
self.name = TextInput(multilines=False)
self.add_widget(self.name)
class MyApp(App):
def build(self):
return MyGrid()
if __name__ == "__name__":
MyApp().run()