猕猴桃黑屏

时间:2019-11-07 14:20:42

标签: python kivy

我在Windows 10上安装了kivy,将环境变量设置为KIVY_GL_BACK = angle_sdl2。但运行代码后出现黑屏

from kivy.app import App 
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput


class LoginScreen(GridLayout):
    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        self.cols = 2

        self.add_widget(Label(text="Username:"))
        self.username = TextInput(multiline=False)
        self.add_widget(self.username)

        self.add_widget(Label(text="Password:"))
        self.password = TextInput(multiline=False, password=True)
        self.add_widget(self.password)


class LoginApp(App):
    def build(self):
        return LoginScreen()


if __name__ == "__main__":
    LoginApp().run()

我希望结果是登录表单。它没有显示任何错误

0 个答案:

没有答案