Closed sm8ps closed 8 months ago
I would guess that the issue is with Pygame. Which version of Pygame is installed and have you tried upgrading it?
Thanks @lordmauve for your suggestion! I had tried several different things, installing the Pgzero package from within Thonny which pulled in the most recent version of Pygame. I tried with Thonny installed as a DEB and as a Snap. Neither did work at all. Then I switched to the command line and created a venv which did not work at first but now that I tried it again it did work. Somewhere along the course I must have done something wrong but I lost track of all the things I tried.
tldr: Installing pgzero from Thonny on Ubuntu did not work, venv on the command-line does.
@sm8ps So which Pygame were you running and which worked?
In the venv, they are all the most recent ones as available on Ubuntu 23.04: pgzero-1.2.1.dist-info/ pygame-2.5.2.dist-info/ numpy-1.26.2.dist-info/
Thonny as a Snap package installs the following: pgzero 1.2.2 pygame 2.5.2 numpy 1.26.2
When I tried today, Thonny did work to some degree, namely launching a correctly sized window instead of the full black screen but there was no colored background but instead a transparent one. It seems to me that it does not work well with compositing graphics. Turning those effects off makes things work as I just discovered. So that seems to be the cause of the faulty behavior.
tldr: turn off compositing when running from Thonny on Kubunt (KDE).
Just for future reference: the source of the problem was not compositing itself as I found out while continuously struggling with this issue. Rather it was due to an application called Gromit-MPX that let’s you annotate on screen which somehow seems to interact with PGzero, compositing or what not. Shutting down Gromit-MPX lets PGzero run without a flaw, even with compositinig turnd on. Yay! Reference to a similar issue: https://forum.manjaro.org/t/disabling-kwin-compositor-causes-screen-to-go-a-permanent-black/128908
I am almost ready to give up on this library because there seems to be no way to make use of it. Even the simplemost script results in the desktop being covered by a black screen without any way to escape from it. Even the PGZero window itself is hidden behind that as I can see by a quick glance. I can kill the window with Ctrl+Q or select it with Alt+TAB and close it from the windows overview. Something is totally borked!
I am running KUbuntu 22.04 and have pgzero installed in a virtual environment via pip. I experienced the exact same behavior from the Thonny editor with its built-in package system.
Here is a simple example:
I expect a window sized 200 by 200 pixels with a red background. There does appear a 200x200 window with black (!) screen but the whole desktop is immediately covered by a black screen that even hides any virtual desktop.
I have done about two hours of research for trouble shooting and would greatly appreciate any help.