Skip to content

Add anchor_label method #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

shubham0x13
Copy link
Contributor

Added anchor_label method which allows easy anchoring/positioning of label based on predefined anchor points and screen size.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jun 4, 2025

@shubham0x13 Thanks for working on this. It does seem like a convenient way to anchor to some of the most likely to be used places. But I think I'd like to consider some other options to incorporate the functionality.

If we do include it in this library I think maybe a different name could be better anchor_label feels a little ambiguous between a noun and a verb, taken as a verb the "label" feels redundant since it's on the Label class so can be assumed to deal with the label without needing it called out in the name.

I am kind of leaning towards thinking this functionality should live somewhere else other than the display text library though. There are a handful of other classes that have anchor_point and anchored_position APIs that match the functionality of Label: Any sub-classes of Widget, also AnchoredTileGrid, and AnchoredGroup. I think it would be nice to centralize this functionality somewhere and have the first argument to the function be any object with this API rather than a self instance. That way the function can live in one spot and be used with all of the various types of objects that support it.

I am not 100% decided on where seems like the right place for it to actually live but I am thinking inside of Adafruit_Displayio_Layout makes sense because at it's core the functionality is to help you lay things out on your screen. Perhaps just as a helper function inside of https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout/blob/main/adafruit_displayio_layout/layouts/__init__.py

Would you be willing to refactor this and move it to a function over there?

@shubham0x13
Copy link
Contributor Author

shubham0x13 commented Jun 5, 2025

@FoamyGuy Thanks! Moved it as suggested and opened a PR there.

@shubham0x13 shubham0x13 closed this Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy