Kivy - unable to get window, break

I get what seems to be a common error being executed by the Kivy hello world program. I tried the solutions I saw here: manually install gstreamer , adding it to PATH and installing PySDL2 . My OS is Windows 7, all other version information is in the error log.

Any suggestions for fixing this would be appreciated.

 # you need this two lines: import os os.environ['KIVY_IMAGE'] = 'pil,sdl2' #kivy program from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): return Button(text='Hello World') TestApp().run() 

Error Log:

 [INFO ] [Logger ] Record log in C:\Users\xyz\.kivy\logs\kivy_16-11-19_11.txt [INFO ] [Kivy ] v1.9.1 [INFO ] [Python ] v2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] [INFO ] [Factory ] 179 symbols loaded [INFO ] [Image ] Providers: img_pil, img_sdl2 (img_tex, img_dds, img_ffpyplayer, img_gif ignored) [INFO ] [Text ] Provider: sdl2 [INFO ] [OSC ] using <thread> for socket [INFO ] [Window ] Provider: sdl2 [INFO ] [GL ] GLEW initialization succeeded [INFO ] [GL ] OpenGL version <3.1.0 - Build 8.15.10.2538> [INFO ] [GL ] OpenGL vendor <Intel> [INFO ] [GL ] OpenGL renderer <Intel(R) HD Graphics Family> [INFO ] [GL ] OpenGL parsed version: 3, 1 [INFO ] [GL ] Shading version <1.40 - Intel Build 8.15.10.2538> [INFO ] [GL ] Texture max size <8192> [INFO ] [GL ] Texture max units <16> [INFO ] [Shader ] fragment shader: <No errors.> [INFO ] [Shader ] vertex shader: <No errors.> [INFO ] [Shader ] program: <No errors.> [CRITICAL ] [Window ] Unable to find any valuable Window provider at all! sdl2 - AttributeError: tobytes File "C:\Program Files\python27\lib\site-packages\kivy\core\__init__.py", line 67, in core_select_lib cls = cls() File "C:\Program Files\python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 138, in __init__ super(WindowSDL, self).__init__() File "C:\Program Files\python27\lib\site-packages\kivy\core\window\__init__.py", line 722, in __init__ self.create_window() File "C:\Program Files\python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 255, in create_window super(WindowSDL, self).create_window() File "C:\Program Files\python27\lib\site-packages\kivy\core\window\__init__.py", line 897, in create_window self.render_context = RenderContext() File "kivy\graphics\instructions.pyx", line 756, in kivy.graphics.instructions.RenderContext.__init__ (kivy\graphics\instructions.c:10729) File "C:\Program Files\python27\lib\site-packages\kivy\core\image\__init__.py", line 512, in __init__ self.filename = arg File "C:\Program Files\python27\lib\site-packages\kivy\core\image\__init__.py", line 700, in _set_filename mipmap=self._mipmap, nocache=self._nocache) File "C:\Program Files\python27\lib\site-packages\kivy\core\image\__init__.py", line 430, in load im = loader(filename, **kwargs) File "C:\Program Files\python27\lib\site-packages\kivy\core\image\__init__.py", line 198, in __init__ self._data = self.load(filename) File "C:\Program Files\python27\lib\site-packages\kivy\core\image\img_pil.py", line 101, in load return list(self._img_read(im)) File "C:\Program Files\python27\lib\site-packages\kivy\core\image\img_pil.py", line 86, in _img_read img_tmp.mode.lower(), img_tmp.tobytes()) File "C:\Program Files\python27\lib\site-packages\PIL\Image.py", line 514, in __getattr__ raise AttributeError(name) [CRITICAL ] [App ] Unable to get a Window, abort. Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored [CRITICAL ] [App ] Unable to get a Window, abort. 
+7
python kivy
source share
4 answers

In cmd, go to python34 and then in the script and install the following:

 pip install --upgrade pip wheel setuptools pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew pip install kivy.deps.gstreamer pip install kivy.deps.angle pip install kivy 
+15
source share

Try putting <python dir>\share\sdl2\bin in your path, it should do the trick. The fact is that he cannot find the sdl2 binary with which he works. There probably doesn't even exist a PIL window provider , so using an environment variable will not create anything to create a window (it will be used as an image provider, though).

I am not very familiar with PySDL2, so I can not help it, however I did an installer for Kivy on Windows to make it easier for beginners.

In any case, you will end up with two ways:

  • You put bin folders in your PATH variable permanently

    I think this is really stupid if you are not sure that you will not delete Python or the folder, otherwise you will have a ghost folder in PATH +, all other programs will have access to the files in the bin folders through PATH

  • You will have a batch file that does this temporarily

    Only programs launched from the console / package will have access to the bin folder.

The installer does this for you and actually even installs from scratch (without Python) or many other things.

If you have not installed Kivy dependencies, do it first.

+4
source share

Not sure about Windows or Linux, but on python-for-android at the very top you need to put:

 #qpy:kivy import kivy kivy.require('your version of kivy') 
+1
source share

Disable 3D acceleration and 2D video acceleration in the display settings of virtual software (aka vmbox, vmware). I think this will work for you, it works for me after many attempts.

0
source share

All Articles