Skip to content

Pygame_GUI on a Raspberry Pi Zero2 without desktop cannot find default font #612

Open
@dickh768

Description

@dickh768

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)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions