Comments (5)
After a few hours of trying to figure out the design of Label, it seems to be because of the sub-Group within the label, the init method refers to
# self Group will contain a single local_group which contains a Group (self.local_group)
# which contains a TileGrid
# The self scale should always be 1
super().__init__(max_size=1, scale=1, **kwargs)
# local_group will set the scale
self.local_group = displayio.Group(max_size=max_glyphs + 1, scale=scale)
However, both the local scale and the local_group scale value are adjusted when scale is updated after a transformation
def scale(self, new_scale):
current_anchored_position = self.anchored_position
self._scale = new_scale
self.local_group.scale = new_scale
self.anchored_position = current_anchored_position
The attached diff is one possible fix, that keeps the local scale at 1 and uses the scale from the local_group
diff.txt
This produces the attached image:
from adafruit_circuitpython_display_text.
I think this bug is specifically inside of Blinka_Displayio instead of this library. If you run the same code on a PyPortal (or other microcontroller) the scale won't get doubled up. There is an issue here that is for what I think the root cause is: adafruit/Adafruit_Blinka_Displayio#45
from adafruit_circuitpython_display_text.
@lesamouraipourpre
Good find on this bug. I agree with your solution. Can you submit a pull request to fix?
from adafruit_circuitpython_display_text.
Nice! I tested this out successfully with Blinka_Displayio and it does resolve the extra scaling. Thank you for digging into this and finding a solution @lesamouraipourpre.
I am still kind of curious about what the difference between core displayio and blinka_displayio that might cause the current code to behave differently.
But definitely happy to have a solution for it here in this library as well. If you can make a PR for this it would be awesome. No worries if not though I can work making on with this change in the next few days.
from adafruit_circuitpython_display_text.
from adafruit_circuitpython_display_text.
Related Issues (20)
- 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
- Add error handling for misspelled kwargs in adafruit_display_text.label HOT 4
- Feature Request: wrap_text_to_pixels truncate argument
- Property `background_tight` not working for `bitmap_label.Label`
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.