问题
Anyone know how to use kivy? I installed it on my window7, python2.7. When I run following code:
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello World!')
if __name__ == '__main__':
MyApp().run()
it gives following error:
Unable to get a Window, abort.
I tried on python3.4, same error. Anyone know how to solve this problem? Please.
回答1:
There is an option that sdl2 can't find dlls needed to load *.png
- Try to find
libpng16-16.dll
on my PC is here: C:\Python27\share\gstreamer\bin
Add it to PATH
set PATH=C:\Python27\share\gstreamer\bin;%PATH%
This is temporary solution but it works for me
来源:https://stackoverflow.com/questions/34640466/kivy-with-error-unable-to-get-a-window