How do you find the y-coordinate of a widget in a VerticalLayout #450
Unanswered
brentmparker
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm starting to learn Textual from the main branch (I'm very much looking forward to the CSS branch becoming more stable. It looks awesome!) and needed a scrolling list of widgets. Looking through the discussions I found this code from another user. It seems to work alright, but I also want the feature to be able to cycle through the widgets with the keyboard and scroll a widget into view when it is focused on.
I came up with the very hacky solution below, but I don't like it. When I find a focusable widget, I have to use the widget's parent's _cached_arrangement to get the region.
Any suggestions on how to find the y-coordinate of a widget? I tried
self.get_widget_region
but that causes a crash because VerticalLayouts dont' create a _layout_map.Thanks for your time!
Beta Was this translation helpful? Give feedback.
All reactions