How do i change the orientation of a widget? #1581
-
I am trying to make a Vertical scale to make a volume rocker. But i cant seem to find out how to change the orientation in Toga. I looked at the relevent documentation and did not find anything for changing orientation Here is the code for the slider implementation in GTK: I saw this hard coded value
I know For GNU/Linux, GTK is used so i looked at that, and i found this: How would i change the orientation of a widget in beeware, in a UI framework independent way? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Right now, there's no cross-platform API for a vertical slider. Toga has precedent for having vertical/horizontal control in APIs - the Divider widget is probably the easiest example of this - and it looks like Cocoa and Winforms both have direction control exposed on their slider widget APIs. If you're up for a FLOSS contribution challenge, I wouldn't be opposed to a PR that adds direction control to the Slider widget. In the immediate term, you can use the GTK API directly - if your app code contains a slider widget |
Beta Was this translation helpful? Give feedback.
Right now, there's no cross-platform API for a vertical slider.
Toga has precedent for having vertical/horizontal control in APIs - the Divider widget is probably the easiest example of this - and it looks like Cocoa and Winforms both have direction control exposed on their slider widget APIs. If you're up for a FLOSS contribution challenge, I wouldn't be opposed to a PR that adds direction control to the Slider widget.
In the immediate term, you can use the GTK API directly - if your app code contains a slider widget
myslider
,myslider._impl.native
will be the nativeGtk.Scale
widget, so you could invokemy slider._impl.native.set_orientation(Gtk.Orientation.VERTICAL)
. This obviously won…