Skip to content

Commit 6d99d98

Browse files
committed
Fix set background for CircuitPython 7
1 parent 8e7d810 commit 6d99d98

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

adafruit_portalbase/graphics.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def __init__(self, display, *, default_bg=0x000000, scale=1, debug=False):
5353
if self._debug:
5454
print("Init background")
5555
self._bg_group = displayio.Group()
56-
self._bg_file = None
5756
self.splash.append(self._bg_group)
5857

5958
# set the default background
@@ -78,18 +77,11 @@ def set_background(self, file_or_color, position=None):
7877

7978
if not file_or_color:
8079
return # we're done, no background desired
81-
if self._bg_file:
82-
self._bg_file.close()
8380
if isinstance(file_or_color, str): # its a filenme:
84-
with open(file_or_color, "rb") as self._bg_file:
85-
background = displayio.OnDiskBitmap(self._bg_file)
81+
background = displayio.OnDiskBitmap(file_or_color)
8682
self._bg_sprite = displayio.TileGrid(
8783
background,
88-
pixel_shader=getattr(
89-
background, "pixel_shader", displayio.ColorConverter()
90-
),
91-
# TODO: Once CP6 is no longer supported, replace the above line with below
92-
# pixel_shader=background.pixel_shader,
84+
pixel_shader=background.pixel_shader,
9385
x=position[0],
9486
y=position[1],
9587
)

0 commit comments

Comments
 (0)