adafruit / Adafruit_CircuitPython_Display_Button

Press it!
MIT License
4 stars 17 forks source link

Null Error from resize when text is blank #45

Open FoamyGuy opened 1 week ago

FoamyGuy commented 1 week ago

reported on discord

I'm working with CircuitPython on a Feather RP2040. Trying to work out displayio and associated libraries, adafruit_displayio_layout is giving me some trouble. I started with this example code which worked once I set it up for my display. https://docs.circuitpython.org/projects/displayio-layout/en/latest/examples.html#gridlayout-simple-text) Then I modified it to add buttons to the grid instead of labels, which the docs for GridLayout says are a valid kind of content, but I'm getting errors that I can't make heads or tails of.

code.py output:
Traceback (most recent call last):
  File "code.py", line 65, in <module>
  File "adafruit_displayio_layout/layouts/grid_layout.py", line 403, in add_content
  File "adafruit_displayio_layout/layouts/grid_layout.py", line 145, in _layout_cells
  File "adafruit_button/button.py", line 284, in resize
  File "adafruit_button/button_base.py", line 81, in label
AttributeError: 'NoneType' object has no attribute 'text'

Code done running.