(location)
| 269 | GSIZE = (160, 160) |
| 270 | |
| 271 | def choose_theme(location): |
| 272 | layout = [[sg.Text(f'Current theme {sg.theme()}')], |
| 273 | [sg.Listbox(values=sg.theme_list(), size=(20, 20), key='-LIST-', enable_events=True)], |
| 274 | [sg.OK(), sg.Cancel()]] |
| 275 | |
| 276 | window = sg.Window('Look and Feel Browser', layout, location=location, keep_on_top=True) |
| 277 | old_theme = sg.theme() |
| 278 | while True: # Event Loop |
| 279 | event, values = window.read() |
| 280 | if event in (sg.WIN_CLOSED, 'Exit', 'OK', 'Cancel'): |
| 281 | break |
| 282 | sg.theme(values['-LIST-'][0]) |
| 283 | test_window=make_window(location=(location[0]-200, location[1]), test_window=True) |
| 284 | test_window.read(close=True) |
| 285 | window.close() |
| 286 | |
| 287 | if event == 'OK' and values['-LIST-']: |
| 288 | sg.theme(values['-LIST-'][0]) |
| 289 | sg.user_settings_set_entry('-theme-', values['-LIST-'][0]) |
| 290 | return values['-LIST-'][0] |
| 291 | else: |
| 292 | sg.theme(old_theme) |
| 293 | return None |
| 294 | |
| 295 | def make_window(location, test_window=False): |
| 296 | title_font = sg.user_settings_get_entry('-title font-', 'Courier 8') |
no test coverage detected