Skip to content

Commit 217af2b

Browse files
authored
Merge pull request #71 from Neradoc/add-remove-qrcode
Allow to remove QR code
2 parents b7252a4 + c4a42e9 commit 217af2b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

adafruit_portalbase/graphics.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,19 @@ def qrcode(
106106
): # pylint: disable=invalid-name
107107
"""Display a QR code
108108
109-
:param qr_data: The data for the QR code.
109+
:param qr_data: The data for the QR code, None to remove.
110110
:param int qr_size: The scale of the QR code.
111111
:param x: The x position of upper left corner of the QR code on the display.
112112
:param y: The y position of upper left corner of the QR code on the display.
113113
114114
"""
115+
if qr_data is None:
116+
if self._qr_group and self._qr_group in self.splash:
117+
self.splash.remove(self._qr_group)
118+
self._qr_group = None
119+
gc.collect()
120+
return
121+
115122
import adafruit_miniqr # pylint: disable=import-outside-toplevel
116123

117124
# generate the QR code

0 commit comments

Comments
 (0)