| 19 | import PySimpleGUI as sg |
| 20 | |
| 21 | def make_window(theme): |
| 22 | sg.theme(theme) |
| 23 | menu_def = [['&Application', ['E&xit']], |
| 24 | ['&Help', ['&About']] ] |
| 25 | right_click_menu_def = [[], ['Edit Me', 'Versions', 'Nothing','More Nothing','Exit']] |
| 26 | graph_right_click_menu_def = [[], ['Erase','Draw Line', 'Draw',['Circle', 'Rectangle', 'Image'], 'Exit']] |
| 27 | |
| 28 | # Table Data |
| 29 | data = [["John", 10], ["Jen", 5]] |
| 30 | headings = ["Name", "Score"] |
| 31 | |
| 32 | input_layout = [ |
| 33 | |
| 34 | # [sg.Menu(menu_def, key='-MENU-')], |
| 35 | [sg.Text('Anything that requires user-input is in this tab!')], |
| 36 | [sg.Input(key='-INPUT-')], |
| 37 | [sg.Slider(orientation='h', key='-SKIDER-'), |
| 38 | sg.Image(data=sg.DEFAULT_BASE64_LOADING_GIF, enable_events=True, key='-GIF-IMAGE-'),], |
| 39 | [sg.Checkbox('Checkbox', default=True, k='-CB-')], |
| 40 | [sg.Radio('Radio1', "RadioDemo", default=True, size=(10,1), k='-R1-'), sg.Radio('Radio2', "RadioDemo", default=True, size=(10,1), k='-R2-')], |
| 41 | [sg.Combo(values=('Combo 1', 'Combo 2', 'Combo 3'), default_value='Combo 1', readonly=False, k='-COMBO-'), |
| 42 | sg.OptionMenu(values=('Option 1', 'Option 2', 'Option 3'), k='-OPTION MENU-'),], |
| 43 | [sg.Spin([i for i in range(1,11)], initial_value=10, k='-SPIN-'), sg.Text('Spin')], |
| 44 | [sg.Multiline('Demo of a Multi-Line Text Element!\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nYou get the point.', size=(45,5), expand_x=True, expand_y=True, k='-MLINE-')], |
| 45 | [sg.Button('Button'), sg.Button('Popup'), sg.Button(image_data=sg.DEFAULT_BASE64_ICON, key='-LOGO-')]] |
| 46 | |
| 47 | asthetic_layout = [[sg.T('Anything that you would use for asthetics is in this tab!')], |
| 48 | [sg.Image(data=sg.DEFAULT_BASE64_ICON, k='-IMAGE-')], |
| 49 | [sg.ProgressBar(100, orientation='h', size=(20, 20), key='-PROGRESS BAR-'), sg.Button('Test Progress bar')]] |
| 50 | |
| 51 | logging_layout = [[sg.Text("Anything printed will display here!")], |
| 52 | [sg.Multiline(size=(60,15), font='Courier 8', expand_x=True, expand_y=True, write_only=True, |
| 53 | reroute_stdout=True, reroute_stderr=True, echo_stdout_stderr=True, autoscroll=True, auto_refresh=True)] |
| 54 | # [sg.Output(size=(60,15), font='Courier 8', expand_x=True, expand_y=True)] |
| 55 | ] |
| 56 | |
| 57 | graphing_layout = [[sg.Text("Anything you would use to graph will display here!")], |
| 58 | [sg.Graph((200,200), (0,0),(200,200),background_color="black", key='-GRAPH-', enable_events=True, |
| 59 | right_click_menu=graph_right_click_menu_def)], |
| 60 | [sg.T('Click anywhere on graph to draw a circle')], |
| 61 | [sg.Table(values=data, headings=headings, max_col_width=25, |
| 62 | background_color='black', |
| 63 | auto_size_columns=True, |
| 64 | display_row_numbers=True, |
| 65 | justification='right', |
| 66 | num_rows=2, |
| 67 | alternating_row_color='black', |
| 68 | key='-TABLE-', |
| 69 | row_height=25)]] |
| 70 | |
| 71 | popup_layout = [[sg.Text("Popup Testing")], |
| 72 | [sg.Button("Open Folder")], |
| 73 | [sg.Button("Open File")]] |
| 74 | |
| 75 | theme_layout = [[sg.Text("See how elements look under different themes by choosing a different theme here!")], |
| 76 | [sg.Listbox(values = sg.theme_list(), |
| 77 | size =(20, 12), |
| 78 | key ='-THEME LISTBOX-', |