Resin + Kivy UI Framework on RPi

Hi!

Does anyone have experiences about ResinOS and the Kivy UI Framework? Kivy is good for things like On-Screen Keyboard and you can run this without a window manager - at least as far as I know …

Not pretty sure but I guess it won’t be that easy to run this inside a container, right?

EDIT:

A friend of mine just stumbled over a Kivy Docker Image - We will try running this on a Resin powered device today

Simon

1 Like

This looks interesting! Looking at that Dockerfile, you might be able to start from a -python resin.io image (e.g. resin/raspberrypi3-python:3, and reduce the number of things needed to be installed there (that’s a hunch).

Would love to hear when you made that work, in the London office we have a pretty nice big screen with touch support (I’m guessing that’s required for on-screen keyboard), and would love to try this! :smile:

By the way, out of curiosity, what sort of hardware setup are you using with this?

Hey @simonkemper,
I had played around with Kivy on the RPI3 and official 7" LCD a while ago. I pushed my code here: https://github.com/shaunmulligan/resin-kivy , but its not a very complete project as I got side tracked while working on it. Hopefully it still all builds correctly.

Let me know.
Cheers
Shaun

Hey there everyone!

I’m new to this forum but i wanted to reach out because i’m having a hard time in getting my kivy app working.
The Kivy app i developed is working with python3.5, Cython 0.27 and kivy 1.10 and works really wel when installed on a raspbian image.

For development purposes and pipelining the stuff in a CI way i want to get the app running in a docker container and that was the point that i started to get headaches:tired_face:

I’ve been at it off and on for about 2 months now and i’m still not able to get the screen working from inside the container. Tried all the setups that I could find, rebuilding trying again and still the kivy app is not able to recognise the egl-rpi driver.

I’m using a raspberry-pi3 with the official 7" screen and i could not find a confirmation on the internet that somebody got it working with a kivy app within a container.

@shaunmulligan
Testing your code got me a different error suggesting that the integration of the userland package in the kivy build could be the solution but I got an error stating that he failed to get the display size.

[WARNING] [Config      ] Older configuration version detected (15 instead of 20)
[WARNING] [Config      ] Upgrading configuration in progress.
[INFO   ] [Logger      ] Record log in /usr/src/app/logs/kivy_18-04-11_0.txt
[INFO   ] [Kivy        ] v1.10.1.dev0, git-d3d517d, 20180411
[INFO   ] [Python      ] v2.7.9 (default, Sep 17 2016, 20:55:23)
[GCC 4.9.2]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: egl_rpi
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
egl_rpi - BCMDisplayException: Failed to get display size
  File "/usr/local/lib/python2.7/site-packages/kivy/core/__init__.py", line 67, in core_select_lib
    cls = cls()
  File "/usr/local/lib/python2.7/site-packages/kivy/core/window/__init__.py", line 960, in __init__
    self.create_window()
  File "/usr/local/lib/python2.7/site-packages/kivy/core/window/window_egl_rpi.py", line 33, in create_window
    w, h = bcm.graphics_get_display_size(self._rpi_dispmanx_id)
  File "kivy/lib/vidcore_lite/bcm.pyx", line 74, in kivy.lib.vidcore_lite.bcm.graphics_get_display_size

sdl2 - RuntimeError: No available video device
  File "/usr/local/lib/python2.7/site-packages/kivy/core/__init__.py", line 67, in core_select_lib
    cls = cls()
  File "/usr/local/lib/python2.7/site-packages/kivy/core/window/window_sdl2.py", line 140, in __init__
    super(WindowSDL, self).__init__()
  File "/usr/local/lib/python2.7/site-packages/kivy/core/window/__init__.py", line 960, in __init__
    self.create_window()
  File "/usr/local/lib/python2.7/site-packages/kivy/core/window/window_sdl2.py", line 272, in create_window
    self.fullscreen, resizable, state)
  File "kivy/core/window/_window_sdl2.pyx", line 93, in kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
  File "kivy/core/window/_window_sdl2.pyx", line 66, in kivy.core.window._window_sdl2._WindowSDL2Storage.die

x11 - ImportError: No module named window_x11
  File "/usr/local/lib/python2.7/site-packages/kivy/core/__init__.py", line 59, in core_select_lib
    fromlist=[modulename], level=0)

[CRITICAL] [App         ] Unable to get a Window, abort.

Shaun, I wanted ask you if got your sample code actually running on the screen? Is it even doable?

Is anyone able to help me with this or could tell me if this is an error based on the fact that there is now a egl-rpi driver but it still cannot access the screen or is based on something else.

Any help is much appreciated:smiley:

Kind Regards Nick

Hello again!

Continued to fiddle with the setup I remembered reading about the GPU accelerated use needed more memory so I change the gpu_mem values and now it is working!! Whoho!

Special thanks for @shaunmulligan for sharing his project!

1 Like