From b4c5f77ceec8dfc2968a0bfbdee7b6ba14a8fe5f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 12 Feb 2025 15:45:40 -0600 Subject: [PATCH] Update how board.DISPLAY is checked Historically, boards with no built-in display have not had a `board.DISPLAY` property. Soon, with https://github.com/adafruit/circuitpython/pull/10028, any board with displayio will have a `board.DISPLAY` property. This property will be `None` if no display is configured, or a truthy non-`None` value if a display is configured (including dynamically at runtime). This revised check will work on both old and new circuitpython versions. --- adafruit_bitmapsaver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_bitmapsaver.py b/adafruit_bitmapsaver.py index d01685f..4b7d892 100644 --- a/adafruit_bitmapsaver.py +++ b/adafruit_bitmapsaver.py @@ -168,7 +168,7 @@ def save_pixels( :param palette: the Palette to use for looking up colors in the bitmap """ if not pixel_source: - if not hasattr(board, "DISPLAY"): + if not getattr(board, "DISPLAY", None): raise ValueError("Second argument must be a Bitmap or Display") pixel_source = board.DISPLAY pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy