Aug-11-2018, 11:38 PM
(This post was last modified: Aug-11-2018, 11:38 PM by PySimpleGUI.)
(Aug-11-2018, 10:38 PM)heromed Wrote: How can I get the values from s slider when a slider is moved,
How can I get the values once an item is selected from a ComboBox ?
If you are using the latest PySimpleGUI from github, you'll want to download the version I just now uploaded. I broke sliders evidently yesterday.
The return values are either a dictionary or a list depending on how you specified you Elements in your layout. If you used a "key" keyword on any element, then your results will be in dictionary form.
This form has a combobox and a slider:
import PySimpleGUI as sg with sg.FlexForm('Combo & Slider Demo') as form: layout = [ [sg.Text('Example of a slider and Combobox',font=("Helvetica", 15), text_color='blue')], [sg.InputCombo(['Combobox 1', 'Combobox 2'], size=(20, 3))], [sg.Slider(range=(1, 100), orientation='h', size=(35, 20), default_value=85)], [sg.OK()] ] button, values = form.LayoutAndRead(layout) print(values)This is what the print statement printed:
Output:['Combobox 1', 85]
I could have written:button, (combo, slider) = form.LayoutAndRead(layout)this will populate the variables combo and slider with the values from those 2 fields.