Skip to content

Commit a8cea0c

Browse files
committed
For business card, display background and labels together
When displaying the business card, group the calls to add the background bitmap and the labels to the group in the same place in code, allowing them to display at the same time. This change has removed the black background around the labels, which appeared to be caused by a bug, since labels don't have a background color property.
1 parent 4bfb679 commit a8cea0c

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

adafruit_pybadger.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,14 +289,6 @@ def show_business_card(self, *, image_name=None, name_string=None, name_scale=1,
289289
``terminalio.FONT``.
290290
291291
"""
292-
business_card_splash = displayio.Group(max_size=4)
293-
self.display.show(business_card_splash)
294-
with open(image_name, "rb") as file_name:
295-
on_disk_bitmap = displayio.OnDiskBitmap(file_name)
296-
face_image = displayio.TileGrid(on_disk_bitmap, pixel_shader=displayio.ColorConverter())
297-
business_card_splash.append(face_image)
298-
self.display.refresh()
299-
300292
business_card_label_groups = []
301293
if name_string:
302294
name_group = self._create_label_group(text=name_string,
@@ -317,8 +309,15 @@ def show_business_card(self, *, image_name=None, name_string=None, name_scale=1,
317309
height_adjustment=0.91)
318310
business_card_label_groups.append(email_two_group)
319311

320-
for group in business_card_label_groups:
321-
business_card_splash.append(group)
312+
business_card_splash = displayio.Group(max_size=4)
313+
self.display.show(business_card_splash)
314+
with open(image_name, "rb") as file_name:
315+
on_disk_bitmap = displayio.OnDiskBitmap(file_name)
316+
face_image = displayio.TileGrid(on_disk_bitmap, pixel_shader=displayio.ColorConverter())
317+
business_card_splash.append(face_image)
318+
for group in business_card_label_groups:
319+
business_card_splash.append(group)
320+
self.display.refresh()
322321

323322
# pylint: disable=too-many-locals
324323
def show_badge(self, *, background_color=0xFF0000, foreground_color=0xFFFFFF,

0 commit comments

Comments
 (0)