The PySimpleGUI "Home"
()
| 25559 | # MMMMMMMMMMMMMM |
| 25560 | |
| 25561 | def main(): |
| 25562 | """ |
| 25563 | The PySimpleGUI "Home" |
| 25564 | """ |
| 25565 | forced_modal = DEFAULT_MODAL_WINDOWS_FORCED |
| 25566 | # set_options(force_modal_windows=True) |
| 25567 | window = _create_main_window() |
| 25568 | set_options(keep_on_top=True) |
| 25569 | i = 0 |
| 25570 | # Don't use the debug window |
| 25571 | # Print('', location=(0, 0), font='Courier 10', size=(100, 20), grab_anywhere=True) |
| 25572 | # print(window.element_list()) |
| 25573 | while True: # Event Loop |
| 25574 | event, values = window.read() |
| 25575 | if event != TIMEOUT_KEY and event != TIMER_KEY: |
| 25576 | print(event, '\n', dict_to_string(values, indent=5)) |
| 25577 | # Print(event, text_color='white', background_color='red', end='') |
| 25578 | # Print(values) |
| 25579 | if event == WIN_CLOSED or event == WIN_CLOSE_ATTEMPTED_EVENT or event == 'Exit' or (event == '-BMENU-' and values['-BMENU-'] == 'Exit'): |
| 25580 | break |
| 25581 | |
| 25582 | # --------------------------------- Animations update --------------------------------- |
| 25583 | window['-IMAGE-'].update_animation_no_buffering(DEFAULT_BASE64_LOADING_GIF, time_between_frames=50) |
| 25584 | |
| 25585 | |
| 25586 | if event == 'Button': |
| 25587 | window.Element('-TEXT1-').SetTooltip('NEW TEXT') |
| 25588 | window.Element('-MENU-').Update(visible=True) |
| 25589 | elif event == 'Popout': |
| 25590 | show_debugger_popout_window() |
| 25591 | elif event == 'Launch Debugger': |
| 25592 | show_debugger_window() |
| 25593 | elif event == 'About...': |
| 25594 | popup('About this program...', 'You are looking at the Home Window for the PySimpleGUI module', version, keep_on_top=True, image=DEFAULT_BASE64_ICON) |
| 25595 | elif event.startswith('See'): |
| 25596 | window._see_through = not window._see_through |
| 25597 | window.set_transparent_color(theme_background_color() if window._see_through else '') |
| 25598 | elif event == 'Popup': |
| 25599 | popup('This is your basic popup', keep_on_top=True) |
| 25600 | elif event == 'Get File': |
| 25601 | popup_scrolled('Returned:', popup_get_file('Get File', keep_on_top=True)) |
| 25602 | elif event == 'Get Folder': |
| 25603 | popup_scrolled('Returned:', popup_get_folder('Get Folder', keep_on_top=True)) |
| 25604 | elif event == 'Get Date': |
| 25605 | popup_scrolled('Returned:', popup_get_date(keep_on_top=True)) |
| 25606 | elif event == 'Get Text': |
| 25607 | popup_scrolled('Returned:', popup_get_text('Enter some text', keep_on_top=True)) |
| 25608 | elif event.startswith('-UDEMY-'): |
| 25609 | webbrowser.open_new_tab(r'https://www.udemy.com/course/pysimplegui/') |
| 25610 | elif event == 'Online 5.0 Docs': |
| 25611 | if webbrowser_available: |
| 25612 | webbrowser.open_new_tab(URL_DOCS) |
| 25613 | elif event in ('-EMOJI-HEARTS-', '-HEART-', '-PYTHON HEARTS-'): |
| 25614 | webbrowser.open_new_tab(r'https://www.python.org/downloads/') |
| 25615 | elif event == 'Themes': |
| 25616 | search_string = popup_get_text('Enter a search term or leave blank for all themes', 'Show Available Themes', keep_on_top=True) |
| 25617 | if search_string is not None: |
| 25618 | theme_previewer(search_string=search_string) |
no test coverage detected