-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port to pygame_sdl2? #25
Comments
Hi, the first error you got Check in your Try also |
In my op, means I called pygame.init(). Like I said, I've seen this before from other pygame related modules, and it's caused by a mismatch of initialized data structures. I'm including pygame_sdl2, along with pygame_sdl2.init(), which doesn't jive with a module that's including pygame and expecting pygame.init() to have been executed. You can try calling pygame.font.init() till the cows come home, and it will never work due to the mismatch between the actual pygame module being referenced. |
Ok, I see. But the lib is not forseen for pygame_sdl2 (I didn't paid attention that it is a fork of pygame for SDL2) If you need SDL2, you could install pygame>2.0 which is fully compatible with SDL2 |
I tried that, but apt forces an upgrade of the default installed pygame 1.9.6 package, which doesn't have compatibility with the kmsd video driver needed to support the HDMI touch screen device. The only pygame package that works on this system is the pygame_sdl2. FWIW - this would work fine on an RPi 3B+, which uses the standard fbdev or fbturbo drivers. I migrated to RPi 4B to get more CPU & memory, which is a consequence of adding more & more capabilities to my project. /sigh |
I'm able to install it on Pi OS Buster using the commands:
|
An other way could be tweak python import system. Something like that (I didn't test): import pygame_sdl2
import sys
sys.modules['pygame']=pygame_sdl2
from pygame_vkeyboard import * |
I'm using Raspbian Bullseye 64bit, and it's not the package installation having issues. It's the lack of kmsd driver support compiled in, which causes pygame.display.init() to throw errors about inability to find a driver. |
Understood. I know that Bullseye it's still young and buggy. That why I didn't switched on yet. |
Wouldn't that be similar to editing the vkeyboard .py files as I mentioned in my op? Willing to give it a go, but I'm skeptical... |
Actually, on an RPi 4, it runs with fewer issues. At least so far. |
Yes it will be similar Thant editing files. |
I think that the main reason is that For instance, the error that you are pointing out is about the comparison: if self.sprites.get_clip() != clip_rect:
So if you replace the comparison by (which is also completely acceptable in python but more verbose): if self.sprites.get_clip() is None or self.sprites.get_clip() != clip_rect: The error could gone. But probably to go to the next one until all part of the code is made compatible. |
Haha! Agreed. ATM, I'm going to proceed with my UI design to not include any capabilities requiring keyboard input. I've built my IoT device to support a touchscreen for physical proximity, and a web console for remote access. Functions requiring a keyboard (like naming devices, timers, or presets) will have to remain relegated to the web console (for now). |
Hi!
I found your project and think it would be perfect to include as part of mine. Here's the project hardware/software I'm using:
I'm forced to use the python3-pygame-sdl2 package because the default pygame 1.9.6 package does not support the kernel mode video drivers on an RPi 4, consistently throwing errors about unable to initialize the display or unable to open a console. The sdl2 package works with my drivers as expected.
However, I tried to get your module to work, but it throws various errors because of the (I assume significant) differences between pygame 2.x compiled with SDL2 support. Here's what I tried so far:
Which produces the following error:
I've seen this error before with other pygame modules (pygame_gui, for example). I then edited the .py files within your module package to reference pygame_sdl2 instead of pygame. This produces the following error:
At this point, it would be diving too far down the rabbit hole to get it working only to find out it still doesn't fit my needs. I believe it will, but truthfully would need assistance trying to port this over.
Not sure this is something you're even willing & able to tackle, but thought it won't hurt to ask. Totally understandable if not.
The text was updated successfully, but these errors were encountered: