from kivy.app import App from kivy.uix.button import Button from kivy.uix.boxlayout import BoxLayout class IndexPage(BoxLayout): def __init__(self,**kwargs): super().__init__(**kwargs) #添加一个按钮 self.join = Button(text='Hello World') #将按钮添加到页面控件中 self.add_widget(self.join) class TestApp(App): def build(self): return IndexPage() if __name__ == '__main__': TestApp().run()
[INFO ] [Logger ] Record log in C:\Users\Young\.kivy\logs\kivy_21-07-13_89.txt
[INFO ] [deps ] Successfully imported "kivy_deps.gstreamer" 0.1.17
[INFO ] [deps ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO ] [deps ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "E:\KV\kv-demo-env\lib\site-packages\kivy\__init__.py"
[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO ] [Python ] Interpreter at "E:\KV\kv-demo-env\Scripts\python.exe"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2 (img_pil, img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL" graphics system
[INFO ] [GL ] GLEW initialization succeeded
[INFO ] [GL ] Backend used <glew>
[INFO ] [GL ] OpenGL version <b'4.6.0 - Build 27.20.100.8935'>
[INFO ] [GL ] OpenGL vendor <b'Intel'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) UHD Graphics 620'>
[INFO ] [GL ] OpenGL parsed version: 4, 6
[INFO ] [GL ] Shading version <b'4.60 - Build 27.20.100.8935'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[WARNING] [Image ] Unable to load image <E:\KV\kv-demo-env\lib\site-packages\kivy\data\glsl\default.png>
[CRITICAL] [Window ] Unable to find any valuable Window provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
sdl2 - Exception: SDL2: Unable to load image
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\__init__.py", line 70, in core_select_lib
cls = cls()
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\window\window_sdl2.py", line 152, in __init__
super(WindowSDL, self).__init__()
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\window\__init__.py", line 982, in __init__
self.create_window()
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\window\window_sdl2.py", line 311, in create_window
super(WindowSDL, self).create_window()
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\window\__init__.py", line 1268, in create_window
self.render_context = RenderContext()
File "kivy\graphics\instructions.pyx", line 783, in kivy.graphics.instructions.RenderContext.__init__
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\image\__init__.py", line 561, in __init__
self.filename = arg
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\image\__init__.py", line 756, in _set_filename
mipmap=self._mipmap, nocache=self._nocache)
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\image\__init__.py", line 460, in load
im = loader(filename, **kwargs)
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\image\__init__.py", line 223, in __init__
self._data = self.load(filename)
File "E:\KV\kv-demo-env\lib\site-packages\kivy\core\image\img_sdl2.py", line 47, in load
raise Exception('SDL2: Unable to load image')
[CRITICAL] [App ] Unable to get a Window, abort.