FoamyGuy / Blinka_Displayio_PyGameDisplay

Blinka makes her debut on the big screen! With this library you can use CircuitPython displayio code on PC and Raspberry Pi to output to a PyGame window instead of a hardware display connected to I2C or SPI. This makes it easy to to use displayio elements on HDMI and other large format screens.
MIT License
9 stars 9 forks source link

Some examples don't run on Raspberry Pi #2

Open lesamouraipourpre opened 3 years ago

lesamouraipourpre commented 3 years ago

The above examples all fail to run on Raspberry Pi 4 with File is not a Windows BMP file

> python blinka_displayio_pygamedisplay_simpletest.py 
pygame 2.0.1 (SDL 2.0.9, Python 3.7.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
loading icon: blinka.png
False
Traceback (most recent call last):
  File "blinka_displayio_pygamedisplay_simpletest.py", line 15, in <module>
    display = PyGameDisplay(icon="blinka.png", width=320, height=240)
  File "/mnt/projects/Blinka_Displayio_PyGameDisplay/blinka_displayio_pygamedisplay.py", line 58, in __init__
    super().__init__(None, _INIT_SEQUENCE, **kwargs)
  File "/mnt/projects/Blinka_Displayio_PyGameDisplay/.env/lib/python3.7/site-packages/displayio/display.py", line 128, in __init__
    self._initialize(init_sequence)
  File "/mnt/projects/Blinka_Displayio_PyGameDisplay/blinka_displayio_pygamedisplay.py", line 68, in _initialize
    icon = pygame.image.load(self._icon)
pygame.error: File is not a Windows BMP file

Reading the pygame documentation it seems that GIF, JPG & PNG are only supported if pygame.image.get_extended() is not False.

Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 2.0.1 (SDL 2.0.9, Python 3.7.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.image.get_extended()
False

I don't know what determines if it is extended or not. As far as I can tell I have the appropriate SDL installed:

> apt list | grep installed | grep -i sdl

libsdl-image1.2/stable,now 1.2.12-10+deb10u1 armhf [installed,automatic]
libsdl-mixer1.2/stable,now 1.2.12-15 armhf [installed,automatic]
libsdl-ttf2.0-0/stable,now 2.0.11-6 armhf [installed,automatic]
libsdl1.2debian/testing,now 1.2.15+dfsg2-4+rpt2 armhf [installed,automatic]
libsdl2-2.0-0/testing,now 2.0.9+dfsg1-1+rpt1 armhf [installed,automatic]

Weirdly, I'm convinced that these have run on my Raspberry Pi before