I have a slider which value changes the label. That was easy to understand. Now the problem is I want to use this value to show on another screen. Eventually I want the slider to show 1-16 images on another screen dependent on what value is selected on the slider. Below is what I have as of now, which works well for that screen, but how do I get this value to show on another screen? I know I have to create a class, which have made multiple attempts and each seems to confuse me more than understand it better.
<NewGameScreen>:
name: 'newgame'
BoxLayout:
orientation: 'vertical'
height: 100
Label:
text: 'New Game'
font_size: 70
Label:
text: 'Players'
font_size: 30
pos: 300, 400
Slider:
id: s1
pos: 420, 400
width: '250dp'
min: 1
max: 16
step: 1
value: 1
on_value: s1.value = self.value
Label:
text: '{}'.format(s1.value)
font_size: 30
pos: 670, 400
You can pass values through underlying
ScreenManager
. A working example:Update:
An extended exaple (adding buttons based on slider value):