Form Elements
checkbox.py
import PySimpleGUI as PSG rows = [ [PSG.Checkbox("XBOX",key="XBOX")], [PSG.Checkbox("PS4",key="PS4",default=True)], [PSG.ReadFormButton("Submit values")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) while True: button, value = form.Read() if value["XBOX"]: print("XBOX selected.") if value["PS4"]: print("PS4 selected.")
radio buttons.py
import PySimpleGUI as PSG rows = [ [PSG.Radio("XBOX","CONSOLE",key="XBOX")], [PSG.Radio("PS4","CONSOLE",key="PS4",default=True)], [PSG.ReadFormButton("Submit values")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) while True: button, value = form.Read() if value["XBOX"]: print("XBOX selected.") if value["PS4"]: print("PS4 selected.")
combobox.py
import PySimpleGUI as PSG rows = [ [PSG.InputCombo(["XBOX","PS4"],key="CONSOLE")], [PSG.ReadFormButton("Submit values")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) while True: button, value = form.Read() if value["CONSOLE"] == "XBOX": print("XBOX selected.") if value["CONSOLE"] == "PS4": print("PS4 selected.")
listbox.py
import PySimpleGUI as PSG values = ["XBOX","PS4"] rows = [ [PSG.Listbox(values,key="CONSOLE",size=(30,6))], [PSG.ReadFormButton("Submit values")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) while True: button, value = form.Read() if "XBOX" in value["CONSOLE"]: print("XBOX selected.") if "PS4" in value["CONSOLE"]: print("PS4 selected.")
multiline and slider.py
import PySimpleGUI as PSG rows = [ [PSG.Slider(range=(1, 100), orientation="h", size=(10, 20), default_value=25, key="mySlider")], [PSG.Multiline("type a \n story here", scale=(2,10), key="myMultiline")], [PSG.ReadFormButton("Submit values")] ] form = PSG.FlexForm("This is a form.") form.Layout(rows) while True: button, value = form.Read() print("Slider value: " + str(value["mySlider"])) print(value["myMultiline"])
- Can you create a customer survey / feedback form, utilising at least one of each of the controls shown here?