MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / main

Function main

DemoPrograms/Demo_Fill_Form.py:12–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10'''
11
12def main():
13 sg.theme('TanBlue')
14
15 column1 = [
16 [sg.Text('Column 1', background_color=sg.DEFAULT_BACKGROUND_COLOR,
17 justification='center', size=(10, 1))],
18 [sg.Spin(values=('Spin Box 1', '2', '3'),
19 initial_value='Spin Box 1', key='spin1')],
20 [sg.Spin(values=('Spin Box 1', '2', '3'),
21 initial_value='Spin Box 2', key='spin2')],
22 [sg.Spin(values=('Spin Box 1', '2', '3'), initial_value='Spin Box 3', key='spin3')]]
23
24 layout = [
25 [sg.Text('All graphic widgets in one form!', size=(30, 1), font=("Helvetica", 25))],
26 [sg.Text('Here is some text.... and a place to enter text')],
27 [sg.InputText('This is my text', key='in1')],
28 [sg.CBox('Checkbox', key='cb1'), sg.CBox(
29 'My second checkbox!', key='cb2', default=True)],
30 [sg.Radio('My first Radio! ', "RADIO1", key='rad1', default=True),
31 sg.Radio('My second Radio!', "RADIO1", key='rad2')],
32 [sg.MLine(default_text='This is the default Text should you decide not to type anything', size=(35, 3),
33 key='multi1'),
34 sg.MLine(default_text='A second multi-line', size=(35, 3), key='multi2')],
35 [sg.Combo(('Combobox 1', 'Combobox 2'), key='combo', size=(20, 1)),
36 sg.Slider(range=(1, 100), orientation='h', size=(34, 20), key='slide1', default_value=85)],
37 [sg.OptionMenu(('Menu Option 1', 'Menu Option 2',
38 'Menu Option 3'), key='optionmenu')],
39 [sg.Listbox(values=('Listbox 1', 'Listbox 2', 'Listbox 3'), size=(30, 3), key='listbox'),
40 sg.Slider(range=(1, 100),
41 orientation='v',
42 size=(5, 20),
43 default_value=25, key='slide2', ),
44 sg.Slider(range=(1, 100),
45 orientation='v',
46 size=(5, 20),
47 default_value=75, key='slide3', ),
48 sg.Slider(range=(1, 100),
49 orientation='v',
50 size=(5, 20),
51 default_value=10, key='slide4'),
52 sg.Col(column1, background_color='gray34')],
53 [sg.Text('_' * 80)],
54 [sg.Text('Choose A Folder', size=(35, 1))],
55 [sg.Text('Your Folder', size=(15, 1), justification='right'),
56 sg.InputText('Default Folder', key='folder'), sg.FolderBrowse()],
57 [sg.Button('Exit'),
58 sg.Text(' ' * 40), sg.Button('SaveSettings'), sg.Button('LoadSettings')]
59 ]
60
61 window = sg.Window('Form Fill Demonstration', layout, default_element_size=(40, 1), grab_anywhere=False)
62
63 while True:
64 event, values = window.read()
65
66 if event == 'SaveSettings':
67 filename = sg.popup_get_file('Save Settings', save_as=True, no_window=True)
68 window.SaveToDisk(filename)
69 # save(values)

Callers 1

Demo_Fill_Form.pyFile · 0.70

Calls 2

readMethod · 0.95
closeMethod · 0.95

Tested by

no test coverage detected