NOT user callable Creates the window (for real) lays out all the elements, etc. It's a HUGE set of things it does. It's the basic "porting layer" that will change depending on the GUI framework PySimpleGUI is running on top of. :param window: you window object :type window:
(window)
| 17787 | |
| 17788 | # ----====----====----====----====----==== STARTUP TK ====----====----====----====----====----# |
| 17789 | def StartupTK(window): |
| 17790 | """ |
| 17791 | NOT user callable |
| 17792 | Creates the window (for real) lays out all the elements, etc. It's a HUGE set of things it does. It's the basic |
| 17793 | "porting layer" that will change depending on the GUI framework PySimpleGUI is running on top of. |
| 17794 | |
| 17795 | :param window: you window object |
| 17796 | :type window: (Window) |
| 17797 | |
| 17798 | """ |
| 17799 | window = window # type: Window |
| 17800 | # global _my_windows |
| 17801 | # ow = _my_windows.NumOpenWindows |
| 17802 | ow = Window.NumOpenWindows |
| 17803 | # print('Starting TK open Windows = {}'.format(ow)) |
| 17804 | if ENABLE_TK_WINDOWS: |
| 17805 | root = tk.Tk() |
| 17806 | elif not ow and not window.ForceTopLevel: |
| 17807 | # if first window being created, make a throwaway, hidden master root. This stops one user |
| 17808 | # window from becoming the child of another user window. All windows are children of this hidden window |
| 17809 | _get_hidden_master_root() |
| 17810 | root = tk.Toplevel(class_=window.Title) |
| 17811 | else: |
| 17812 | root = tk.Toplevel(class_=window.Title) |
| 17813 | if window.DebuggerEnabled: |
| 17814 | root.bind('<Cancel>', window._callback_main_debugger_window_create_keystroke) |
| 17815 | root.bind('<Pause>', window._callback_popout_window_create_keystroke) |
| 17816 | |
| 17817 | # If location is None, then there's no need to hide the window. Let it build where it is going to end up being. |
| 17818 | if DEFAULT_HIDE_WINDOW_WHEN_CREATING is True and window.Location is not None: |
| 17819 | try: |
| 17820 | if not running_mac() or \ |
| 17821 | (running_mac() and not window.NoTitleBar) or \ |
| 17822 | (running_mac() and window.NoTitleBar and not _mac_should_apply_notitlebar_patch()): |
| 17823 | |
| 17824 | root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint' |
| 17825 | except Exception as e: |
| 17826 | print('*** Exception setting alpha channel to zero while creating window ***', e) |
| 17827 | |
| 17828 | if window.BackgroundColor is not None and window.BackgroundColor != COLOR_SYSTEM_DEFAULT: |
| 17829 | root.configure(background=window.BackgroundColor) |
| 17830 | Window._IncrementOpenCount() |
| 17831 | |
| 17832 | window.TKroot = root |
| 17833 | |
| 17834 | window._create_thread_queue() |
| 17835 | |
| 17836 | # for the Raspberry Pi. Need to set the attributes here, prior to the building of the window |
| 17837 | # so going ahead and doing it for all platforms, in addition to doing it after the window is packed |
| 17838 | # 2023-April - this call seems to be causing problems on MacOS 13.2.1 Ventura. Input elements become non-responsive |
| 17839 | # if this call is made here and at the end of building the window |
| 17840 | if not running_mac(): |
| 17841 | _no_titlebar_setup(window) |
| 17842 | |
| 17843 | if not window.Resizable: |
| 17844 | root.resizable(False, False) |
| 17845 | |
| 17846 | if window.DisableMinimize: |
no test coverage detected