How to start a pygame-sdl2 app from Scopes
-
How do I start a simple pygame-sdl2 test app from Scopes, like the one below:
#!/usr/bin/env python2 import time import pygame_sdl2 pygame_sdl2.import_as_pygame() import pygame.display pygame.init() di = pygame.display.Info() screen = pygame.display.set_mode((di.current_w, di.current_h), pygame.FULLSCREEN) screen.fill((255,255,255)) pygame.draw.circle(screen, (255, 0, 0), (di.current_w/2, di.current_h/2), 100, 0) pygame.display.flip() time.sleep(2)
I've remounted / as rw, and apt-get install'ed python-pygame-sdl2
I've tried to create a .desktop file in ~/.local/share/applications
and I see that Scopes get's redrawn, but no new icon appears.How should such a .desktop look like? Is it the right way to add an app to Scopes?
Edit: After rebooting the phone, the icon of my app showed up. But how to reload .desktop files in a more smooth way?
-
Firstly, some questions:
- Why are you using python2? It will be end of life next year, and we only support python3 on UT.
- Why are you installing this to rootfs rather than packaging your game into a click?
- What does your
.desktop
file look like?
I don't recall if SDL2 is part of the rootfs, but you will need to include the pygame libraries directly within your click package.
-
Hi @dobey,
- There are only a python2 pygame_sdl2 package available.
- Out of ignorance No idea how to make a click. I'll give it a try.
- After a reboot Scopes shows up my icons. I guess as a click it will work better.
Not sure if SDL2 got included when I installed pygame_sdl2 or not.
Thanks! -
OK. I'm not sure why a python3 version of pygame isn't available in the Ubuntu repositories, so it looks like you will probably need to build your own version to work with python3, as part of the click packaging.
You might want to check out
clickable
for making it easy to package an app up.