-
Notifications
You must be signed in to change notification settings - Fork 12
Description
This library was recently updated as part of the sweep to use with context processors where pylint suggested. But the current way it's implemented does not work properly for this library.
The code here:
Adafruit_CircuitPython_PYOA/adafruit_pyoa.py
Lines 407 to 410 in a6050d9
| with open( | |
| self._gamedirectory + "/" + filename, "rb" | |
| ) as self._background_file: | |
| background = displayio.OnDiskBitmap(self._background_file) |
Essentially "releases" or closes the bmp file as soon as the with block ends which means that it is no longer around when the TileGrid is made and added to the display.
Current behavior causes background images not to be shown at all. It will either need to be refactored to have a larger with block that covers the entire time the image is shown. Or go back to the old way of opening the file and managing the closing of it without the with context block and adding the exception for pylint. I lean toward the latter because the file needs to remain open until the next time that set_background() is called again and I don't know if / how a with block can span across multiple function calls like that.