How to force Kivy 1.9.1 or 1.9.2 to use SDL2 instead of pygame on OSX 10.12.2?

An attempt to force Kivy to use SDL2, not pygame, on OSX 10.12.2 under python 2.7.13 installed by brew. To install the dependencies, I ran the following. It seems that they are installed properly, as the "brew doctor" returns to clean.

brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer pip install -I Cython==0.23 

Then I tried version 1.9.2-dev0 and 1.9.1 Kivy, compiling from source, with an attempt to use SDL. I also tried pip install kivy and not the last code from the repo, and none of these attempts forced Kivy to recognize SDL2.

 git clone http://github.com/kivy/kivy cd kivy USE_SDL2=1 make force USE_OSX_FRAMEWORKS=0 sudo pip install -e kivy bash-3.2$ KIVY_WINDOW=sdl2 KIVY_IMAGE=sdl2 KIVY_CLIPBOARD=sdl2 KIVY_TEXT=sdl2 python main.py [INFO ] [Logger ] Record log in /Users/dancaron/.kivy/logs/kivy_17-01-23_107.txt [INFO ] [Kivy ] v1.9.2-dev0 [INFO ] [Python ] v2.7.13 (default, Jan 23 2017, 19:04:34) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] [INFO ] [Factory ] 193 symbols loaded [INFO ] [Image ] Providers: (img_imageio, img_tex, img_dds, img_pygame, img_ffpyplayer, img_pil, img_gif ignored) [CRITICAL] [App ] Unable to get any Image provider, abort. 

How to get Kivy to use SDL2?

+6
source share
1 answer

I managed to get SDL2 working with Kivy 1.9.2 on OSX 10.12.2 using the following procedure. This assumes brew installed python 2.7 and brew installed SDL2.

1) Download the Kivy source (in the directory / usr / local / lib / python 2.7 / site-packages)

 git clone https://github.com/kivy/kivy cd kivy 

2) Set environment variables to tell Kivy where to find the bundled SDL2 libraries, rather than use the path to the OSX infrastructure and actually use SDL2 and build Kivy.

 KIVY_SDL2_PATH=/usr/local/lib USE_OSX_FRAMEWORKS=0 USE_SDL2=1 make force 

Now, by running the main script, you should see that the Windows provider is SDL2.

 bash-3.2$ python main.py [WARNING] [Config ] Older configuration version detected (14 instead of 17) [WARNING] [Config ] Upgrading configuration in progress. [INFO ] [Kivy ] v1.9.2-dev0 [INFO ] [Python ] v2.7.13 (default, Jan 23 2017, 19:04:34) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] [INFO ] [Factory ] 193 symbols loaded [INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored) [INFO ] [OSC ] using <multiprocessing> for socket [INFO ] [Window ] Provider: sdl2 

Using SDL2 over pygame provides retina support and fixes issues like black screen when resizing a window.

+3
source

Source: https://habr.com/ru/post/1014354/


All Articles