Python Forum
[PySimpleGUI] New GUI Package. Customize with ease
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PySimpleGUI] New GUI Package. Customize with ease
#9
(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.
Reply


Messages In This Thread
RE: [PySimpleGUI] New GUI Package. Customize with ease - by PySimpleGUI - Aug-11-2018, 11:38 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PySimpleGUI Try Except jamesaarr 1 2,024 Nov-18-2021, 02:02 PM
Last Post: jamesaarr
  [PySimpleGUI]Install package on Conda not up-to-date RayJohnson 4 4,614 Jan-22-2020, 11:17 PM
Last Post: RayJohnson

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020