adafruit / Adafruit_Blinka_Displayio

Displayio for Blinka
MIT License
14 stars 20 forks source link

Changing the scale of a TileGrid's parent can cause a crash #47

Closed lesamouraipourpre closed 3 years ago

lesamouraipourpre commented 3 years ago

Changing the scale of the parent of a TileGrid after it has been added to the parent causes a crash.

The following test file demonstrates test_change_scale_on_a_tilegrid_parent.py

And produces

python .\test_change_scale_on_a_tilegrid_parent.py
pygame 2.0.1 (SDL 2.0.14, Python 3.8.5)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File ".\test_change_scale_on_a_tilegrid_parent.py", line 38, in <module>
    display.refresh()
  File ".\lib\site-packages\blinka_displayio_pygamedisplay.py", line 113, in refresh
    self._current_group._fill_area(
  File ".\lib\site-packages\displayio\group.py", line 162, in _fill_area
    layer._fill_area(buffer)  # pylint: disable=protected-access
  File ".\lib\site-packages\displayio\tilegrid.py", line 271, in _fill_area
    image = image.resize(
  File ".\lib\site-packages\PIL\Image.py", line 1913, in resize
    im = im.resize(size, resample, box)
  File ".\lib\site-packages\PIL\Image.py", line 1935, in resize
    return self._new(self.im.resize(size, resample, box))
TypeError: integer argument expected, got float

The cause is PIL expecting integers to be passed in from tilegrid.py:line 271