You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple GUI app running on a Raspberry Pi Zero 2 with desktop which runs well but I would like to drop the desktop since it uses resources which are in short supply on the Zero2. (only 0.5GB memory in particular). Pygame itself seems to run successfully without the desktop provided that SDL2 is installed. However, as soon as the Pygame_GUI manager is invoked, the script errors with:
Traceback (most recent call last):
File "/home/dickh/test.py", line 10, in
manager = pygame_gui.UIManager((480,320))
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/ui_manager.py", line 70, in init
self.ui_theme = self.create_new_theme(theme_path)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/ui_manager.py", line 117, in create_new_theme
theme = UIAppearanceTheme(self.resource_loader, self._locale)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/core/ui_appearance_theme.py", line 62, in init
self.font_dict = UIFontDictionary(self._resource_loader, locale)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/core/ui_font_dictionary.py", line 190, in init
self._load_default_font(self.default_font)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/core/ui_font_dictionary.py", line 222, in _load_default_font
raise error
FileNotFoundError: Unable to load resource with path: pygame_gui.data.NotoSans-Regular.ttf
The above was obtained running a minimal script:
import pygame
import pygame_gui
pygame.init()
screen = pygame.display.set_mode([480,320])
manager = pygame_gui.UIManager((480,320))
pygame.display.set_caption("My Board")
exit = False
while not exit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit = True
pygame.display.update()
I have checked the install directories and all of the font files appear to be in the right place. For some reason this Pygame_GUI installation cannot find them. I initially installed v0.6.0 using PIP and have since tried installing 0.6.12 from source with the same result.
OS: Raspbian GNU/Linux 11 (bullseye)
Kernel: Linux 6.1.21-v7+
Architecture: arm 32bit
Pygame GUI version 0.6.12
Pygame-ce 2.5.0
SDL 2.0.14
Python 3.9.2)
The text was updated successfully, but these errors were encountered:
I can see you're calling pygame.init() which should in turn call pygame.font.init() but can you try explicitly calling pygame.font.init() and seeing what happens?
pygame.init() silently fails when initting modules I think. Whereas if you do the font load explicitly it might give a bit more info to go off
From what I understand SDL itself isn't running well without a desktop on Raspberry Pi at the minute - which is likely to be the root of the problem. The font file is presumably still where it normally is, I expect this error is a result of something cascading from deep in SDL, up through pygame and this is just the final error you are seeing. I would try loading font files with normal pygame code and see if you still get errors.
AFAICT there is nothing I can do about this in Pygame GUI itself, as you said it works fine on raspberry pi with the desktop.
I'll leave this open for now in case you have resolved it or can pin it down further, but I expect I will have to close this here.
I have a simple GUI app running on a Raspberry Pi Zero 2 with desktop which runs well but I would like to drop the desktop since it uses resources which are in short supply on the Zero2. (only 0.5GB memory in particular). Pygame itself seems to run successfully without the desktop provided that SDL2 is installed. However, as soon as the Pygame_GUI manager is invoked, the script errors with:
Traceback (most recent call last):
File "/home/dickh/test.py", line 10, in
manager = pygame_gui.UIManager((480,320))
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/ui_manager.py", line 70, in init
self.ui_theme = self.create_new_theme(theme_path)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/ui_manager.py", line 117, in create_new_theme
theme = UIAppearanceTheme(self.resource_loader, self._locale)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/core/ui_appearance_theme.py", line 62, in init
self.font_dict = UIFontDictionary(self._resource_loader, locale)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/core/ui_font_dictionary.py", line 190, in init
self._load_default_font(self.default_font)
File "/usr/local/lib/python3.9/dist-packages/pygame_gui-0.6.12-py3.9.egg/pygame_gui/core/ui_font_dictionary.py", line 222, in _load_default_font
raise error
FileNotFoundError: Unable to load resource with path: pygame_gui.data.NotoSans-Regular.ttf
The above was obtained running a minimal script:
I have checked the install directories and all of the font files appear to be in the right place. For some reason this Pygame_GUI installation cannot find them. I initially installed v0.6.0 using PIP and have since tried installing 0.6.12 from source with the same result.
OS: Raspbian GNU/Linux 11 (bullseye)
Kernel: Linux 6.1.21-v7+
Architecture: arm 32bit
Pygame GUI version 0.6.12
Pygame-ce 2.5.0
SDL 2.0.14
Python 3.9.2)
The text was updated successfully, but these errors were encountered: