adafruit / Adafruit_Blinka_Displayio

Displayio for Blinka
MIT License
14 stars 20 forks source link

terminalio broken on PIL 8.1 #110

Closed rferrese closed 1 year ago

rferrese commented 1 year ago

Importing terminalio fails on my Raspberry Pi. I have Python 3.9, meaning the correct PIL version is 8 (source). However, getbbox was introduced in version 9.2.0 (source). The change made in change #108 (remove ImageFont.getsize() usage for Pillow 10.0.0) breaks backwards compatibility.

python3 --version => Python 3.9.2

PIL.__version__ l => 8.1.2

>>> import terminalio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.9/site-packages/terminalio.py", line 26, in <module>
    FONT = fontio.BuiltinFont()
  File "/home/pi/.local/lib/python3.9/site-packages/fontio.py", line 56, in __init__
    self._generate_bitmap(0x20, 0x7E)
  File "/home/pi/.local/lib/python3.9/site-packages/fontio.py", line 59, in _generate_bitmap
    char_width, char_height = self.get_bounding_box()
  File "/home/pi/.local/lib/python3.9/site-packages/fontio.py", line 78, in get_bounding_box
    return self._font.getbbox("M")[2:4]
AttributeError: 'ImageFont' object has no attribute 'getbbox'
makermelissa commented 1 year ago

Yeah, the requirements should probably be updated to PIL 10.0.0.