-
Notifications
You must be signed in to change notification settings - Fork 6
Description
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:
- Raspberry Pi 4
- 5" HDMI w/capacitive touch interface
- Raspbian Bullseye 64bit
- Python 3.9.2
- Pygame 2.0 compiled w/SDL2
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:
include pygame_sdl2 as pygame
from pygame_vkeyboard import *
--- do typical initialization ---
Which produces the following error:
. . .
File "/home/pi/TGR-A8D4-TPL-R1/ui/objs.py", line 48, in <module>
keyboard = VKeyboard(tft, consumer, layout)
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vkeyboard.py", line 533, in __init__
self.input = VTextInput((0, 0), (10, 10), renderer=self.renderer)
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vtextinput.py", line 303, in __init__
line = VLine((self.size[0] - 2 * self.text_margin,
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vtextinput.py", line 184, in __init__
self.renderer.draw_text(self.image, '')
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vrenderers.py", line 284, in draw_text
self.font_input = fit_font(self.font_name, surface.get_height())
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vrenderers.py", line 28, in fit_font
font = pygame.font.Font(font_name, 1)
pygame.error: font not initialized
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:
. . .
File "/home/pi/TGR-A8D4-TPL-R1/ui/objs.py", line 48, in <module>
keyboard = VKeyboard(tft, consumer, layout)
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vkeyboard.py", line 533, in __init__
self.input = VTextInput((0, 0), (10, 10), renderer=self.renderer)
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vtextinput.py", line 314, in __init__
self.set_line_rect(*self.position + self.size)
File "/home/pi/.local/lib/python3.9/site-packages/pygame_vkeyboard/vtextinput.py", line 393, in set_line_rect
if self.sprites.get_clip() != clip_rect:
File "src/pygame_sdl2/rect.pyx", line 82, in pygame_sdl2.rect.Rect.__richcmp__
File "src/pygame_sdl2/rect.pyx", line 45, in pygame_sdl2.rect.Rect.__init__
TypeError: object of type 'NoneType' has no len()
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.