You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that the text_wrap value is being passed to the underlying library instead of the value of text_maxlen. When omitting text_maxlen and setting text_wrap as if it was maxlen, the library functions as expected.
I'm unsure if this is an undocumented change in behavior or a bug.
From the docs:
text_wrap – Whether or not to wrap text (for long text data chunks). Defaults to False, no wrapping.
text_maxlen – The max length of the text for text wrapping. Defaults to 0.
With text_maxlen as a list and text_wrap as boolean, a TypeError results
code.py output:
Init display
Init background
Init image path
Init SD Card
Init touchscreen
Init caption
Setting caption to None
Traceback (most recent call last):
File "code.py", line 29, in <module>
File "adafruit_pyportal/__init__.py", line 263, in __init__
TypeError: 'bool' object isn't subscriptable
Code done running.
setting text_wrap=(True, True, True, True), results in a ValueError:
Notice the "Wrapping text with length of True" before the trace.
code.py output:
Init display
Init background
Init image path
Init SD Card
Init touchscreen
Init caption
Setting caption to None
Init text area
Init text area
Init text area
Init text area
Connecting to AP <snip>
Retrieving data...Headers: <snip>
Reply is OK!
<snip>
original URL: <snip>
convert URL: https://io.adafruit.com/api/v2/<snip>/integrations/image-formatter?x-aio-key=<snip>
Fetching stream from https://io.adafruit.com/api/v2/<snip>/integrations/image-formatter?x-aio-key=<snip>
Reply is OK!
<snip>
Saving data to /sd/cache.bmp
Read 41 bytes, 82657 remaining
<snip>
Created file of 82698 bytes in 6.7 seconds
Wrapping text with length of True
Traceback (most recent call last):
File "code.py", line 38, in <module>
File "adafruit_pyportal/__init__.py", line 355, in fetch
File "adafruit_portalbase/__init__.py", line 442, in _fill_text_labels
File "adafruit_portalbase/__init__.py", line 393, in _fetch_set_text
File "adafruit_portalbase/__init__.py", line 238, in set_text
File "adafruit_portalbase/__init__.py", line 137, in wrap_nicely
File "adafruit_display_text/__init__.py", line 140, in wrap_text_to_lines
File "adafruit_display_text/__init__.py", line 128, in chunks
ValueError: zero step
This code, although not matching the documentation, works as expected. text_maxlen is omitted and text_wrap is a list of integers, not boolean.
It appears that the text_wrap value is being passed to the underlying library instead of the value of text_maxlen. When omitting text_maxlen and setting text_wrap as if it was maxlen, the library functions as expected.
I'm unsure if this is an undocumented change in behavior or a bug.
From the docs:
sample code:
With text_maxlen as a list and text_wrap as boolean, a TypeError results
setting text_wrap=(True, True, True, True), results in a ValueError:
Notice the "Wrapping text with length of True" before the trace.
This code, although not matching the documentation, works as expected. text_maxlen is omitted and text_wrap is a list of integers, not boolean.
The text was updated successfully, but these errors were encountered: