Closed yetanotherf0rked closed 4 years ago
Here is a code that builds a slider with a title above :
import thorpy
app = thorpy.Application((800,600))
slider_title = thorpy.make_text("My Slider")
slider_slider = thorpy.SliderX(100, (12, 35), "")
slider = thorpy.make_group([slider_title, slider_slider], "v")
#Uncomment the next line if you want to left-align the title with the slider
##slider_title.stick_to(slider_slider, "left", "left", align=False)
background = thorpy.Background(elements=[slider])
thorpy.store(background)
m = thorpy.Menu(background)
m.play()
thorpy.quit()
The built-in slider class does not provide the title above. The example above shows a quick wrapper. Remember that if you want to get information on the slider itself (e.g. the value), then you have to refer to slider_slider (e.g. slider_slider.get_value), as here "slider" is actually just a box that stores the title and the actual slider element.
When you create a SliderX object with
slider = thorpy.SliderX(100, (12, 35), "My Slider")
The title "My Slider" is just next to the slider. Is there a way to set the title above ? Thanks