Comments (8)
If you pass in max_glyphs=30
or whatever number is your largest size, then it will handle this correctly. If not specified, it assumes the length of the default text is the max_glyphs. I believe this issue is more about having it degrade with a better message since "Group full" is a little misleading.
from adafruit_circuitpython_display_text.
Given the nature of the Label, I would suggest this should either truncate the input text in the property setter method, or otherwise have a more graceful recovery.
from adafruit_circuitpython_display_text.
I believe this behavior is currently as-designed. Label needs the maximum number of characters, or pixel width using the bounding box based on the current font. Enlarging the allocation, auto-truncation option, even a scrolling text option would be great. This gets tricky with multi-line text though.
I often use dynamic label text, so currently have to pre-calculate the width of the new text and create a replacement Label rather than just changing the text of an existing Label.
from adafruit_circuitpython_display_text.
I just encountered this too. I'd suggest either it just truncates or we catch the "Group full" exception and throw with a more meaningful exception message like "Text too long" or "Text exceeds max_glyphs".
from adafruit_circuitpython_display_text.
Agree with above two comments - this issue is just a suggestion for better fail behavior. And once implemented, update the displayio guide.
Would truncating be the more user friendly option?
from adafruit_circuitpython_display_text.
I just got confused with this too. I agree with @dhalbert and @jepler in Discord, a re-throw with a clearer exception would be a good thing.
from adafruit_circuitpython_display_text.
max_glyphs
is also problematic as this is not documented in enough detail for the user to know that this needs to be maximum(all possible text lengths) + 1
- note the + 1
.
The raise RuntimeError("Please provide a max size, or initial text")
in the code doesn't really help here either as it mentions a max size
.
Added later: I've just realised this is due to a fairly recent change in fb0cfee as I had a look into a feedback report for https://learn.adafruit.com/clue-sensor-plotter-circuitpython being broken. I put a simple example in Adafruit Forums: label.Label max_glyphs behaviour has changed
. This was fixed by 5fe2117
from adafruit_circuitpython_display_text.
Closing this for now. Looks like it was nominally fixed with #48.
from adafruit_circuitpython_display_text.
Related Issues (20)
- Width property not working in some cases HOT 4
- save_text=False throws error on init HOT 11
- Missing Type Annotations HOT 1
- Spaces are deleted when word-wrapping HOT 1
- Updates to text are inefficient for special case of same length and width text HOT 3
- bitmap_label losing direction HOT 6
- Suppress warnings in bitmap_label HOT 1
- Use `fontio.FontProtocol` for type annotations
- Label can take Tuple[int, int, int] for color HOT 1
- wrap_text_to_pixels() cannot handle Windows line endings HOT 1
- bitmap_label flicker HOT 1
- Unable to update scrolling_label text outside constructor HOT 2
- Exception with multiple consecutive newlines in bitmap label
- label.Label padding is wrong when using DWR or UPR HOT 5
- button simpletest throws error on PyPortal Titano HOT 1
- bitmap_label errors if no bitmaptools module present
- ValueError from negatives on first character
- Convert `.show()` to `.root_group =` for CircuitPython 9
- Program stops without any error when importing the library HOT 4
- bitmap label cuts off part of text HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit_circuitpython_display_text.