(location)
| 29 | UPDATE_FREQUENCY_MILLISECONDS = 1000*60*60 # update every hour |
| 30 | |
| 31 | def choose_theme(location): |
| 32 | layout = [[sg.Text(f'Current theme {sg.theme()}')], |
| 33 | [sg.Listbox(values=sg.theme_list(), size=(20, 20), key='-LIST-', enable_events=True)], |
| 34 | [sg.OK(), sg.Cancel()]] |
| 35 | |
| 36 | window = sg.Window('Look and Feel Browser', layout, location=location, keep_on_top=True) |
| 37 | old_theme = sg.theme() |
| 38 | while True: # Event Loop |
| 39 | event, values = window.read() |
| 40 | if event in (sg.WIN_CLOSED, 'Exit', 'OK', 'Cancel'): |
| 41 | break |
| 42 | sg.theme(values['-LIST-'][0]) |
| 43 | test_window=make_window(location=(location[0]-200, location[1]), test_window=True) |
| 44 | test_window.read(close=True) |
| 45 | window.close() |
| 46 | |
| 47 | if event == 'OK' and values['-LIST-']: |
| 48 | sg.theme(values['-LIST-'][0]) |
| 49 | sg.user_settings_set_entry('-theme-', values['-LIST-'][0]) |
| 50 | return values['-LIST-'][0] |
| 51 | else: |
| 52 | sg.theme(old_theme) |
| 53 | return None |
| 54 | |
| 55 | def make_window(location, test_window=False): |
| 56 | title_font = sg.user_settings_get_entry('-title font-', 'Courier 8') |
no test coverage detected