From 57f34cb2c1707923354bd4d1f1b60c23b65634a3 Mon Sep 17 00:00:00 2001 From: Mikey Sklar Date: Sun, 1 Nov 2026 07:08:18 -0800 Subject: [PATCH] Pass a filename to OnDiskBitmap in show_business_card and the asyncio example CircuitPython 11 removes the option of passing an open file to OnDiskBitmap. Filenames have worked since CircuitPython 7.0. See adafruit/circuitpython#10444. Co-Authored-By: Claude Opus 5.5 --- adafruit_pybadger/pybadger_base.py | 3 +-- examples/pybadger_pygamer_asyncio.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/adafruit_pybadger/pybadger_base.py b/adafruit_pybadger/pybadger_base.py index 67f4443..50fe49d 100644 --- a/adafruit_pybadger/pybadger_base.py +++ b/adafruit_pybadger/pybadger_base.py @@ -538,8 +538,7 @@ def show_business_card( business_card_label_groups.append(email_two_group) business_card_splash = displayio.Group() - image_file = open(image_name, "rb") - on_disk_bitmap = displayio.OnDiskBitmap(image_file) + on_disk_bitmap = displayio.OnDiskBitmap(image_name) face_image = displayio.TileGrid(on_disk_bitmap, pixel_shader=on_disk_bitmap.pixel_shader) business_card_splash.append(face_image) for group in business_card_label_groups: diff --git a/examples/pybadger_pygamer_asyncio.py b/examples/pybadger_pygamer_asyncio.py index c3ac367..4a560c3 100644 --- a/examples/pybadger_pygamer_asyncio.py +++ b/examples/pybadger_pygamer_asyncio.py @@ -15,7 +15,7 @@ custom_line2 = "LAST" # also a great place to show a pronoun # Set up the custom image -qr_image = OnDiskBitmap(open("/QR_Blinka_CircuitPythonOrg.bmp", "rb")) +qr_image = OnDiskBitmap("/QR_Blinka_CircuitPythonOrg.bmp") qr_tg = TileGrid(qr_image, pixel_shader=qr_image.pixel_shader) qr_gp = Group() qr_gp.append(qr_tg)