diff --git a/PySimpleGUI.py b/PySimpleGUI.py index c89076cf..2c92ac1b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,10 +1,17 @@ #!/usr/bin/python3 -version = __version__ = "4.60.0 Released 8-May-2022" +version = __version__ = "4.60.3 Released 27-Jul-2022" _change_log = """ - Changelog since 4.60.0 released to PyPI on 8-May-2022 + Changelog since 4.60.0 released to PyPI on 8-May-2022. These are "Dot" releases.... + 4.60.1 + A "dot-release" / patch for crash that occurs if the horizontal_scroll parm is set in Listbox element + Was created when the ttk scrollbars were added + 4.60.2 + A "dot-release" for Mac 12.3+ "Invisible window" problem. Adds option in Mac control panel to set Alpha to 0.99 as default + 4.60.3 + Another shot at the 12.3+ Mac OS problem. Had bug in the version check code """ __version__ = version.split()[0] # For PEP 396 and PEP 345 @@ -136,7 +143,6 @@ from uuid import uuid4 # get the tkinter detailed version tclversion_detailed = tkinter.Tcl().eval('info patchlevel') framework_version = tclversion_detailed - import time import pickle import calendar @@ -419,6 +425,7 @@ DEFAULT_TOOLTIP_TIME = 400 DEFAULT_TOOLTIP_OFFSET = (0, -20) DEFAULT_KEEP_ON_TOP = None DEFAULT_SCALING = None +DEFAULT_ALPHA_CHANNEL = 1.0 TOOLTIP_BACKGROUND_COLOR = "#ffffe0" TOOLTIP_FONT = None #################### COLOR STUFF #################### @@ -612,6 +619,7 @@ ENABLE_TREEVIEW_869_PATCH = True ENABLE_MAC_NOTITLEBAR_PATCH = False ENABLE_MAC_MODAL_DISABLE_PATCH = False ENABLE_MAC_DISABLE_GRAB_ANYWHERE_WITH_TITLEBAR = True +ENABLE_MAC_ALPHA_99_PATCH= False OLD_TABLE_TREE_SELECTED_ROW_COLORS = ('#FFFFFF', '#4A6984') ALTERNATE_TABLE_AND_TREE_SELECTED_ROW_COLORS = ('SystemHighlightText', 'SystemHighlight') @@ -9325,7 +9333,7 @@ class Window: element_padding=None, margins=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=None, force_toplevel=False, - alpha_channel=1, return_keyboard_events=False, use_default_focus=True, text_justification=None, + alpha_channel=None, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, grab_anywhere_using_control=True, keep_on_top=None, resizable=False, disable_close=False, disable_minimize=False, right_click_menu=None, transparent_color=None, debugger_enabled=True, right_click_menu_background_color=None, right_click_menu_text_color=None, right_click_menu_disabled_text_color=None, @@ -9515,7 +9523,7 @@ class Window: self.KeepOnTop = keep_on_top self.ForceTopLevel = force_toplevel self.Resizable = resizable - self._AlphaChannel = alpha_channel + self._AlphaChannel = alpha_channel if alpha_channel is not None else DEFAULT_ALPHA_CHANNEL self.Timeout = None self.TimeoutKey = TIMEOUT_KEY self.TimerCancelled = False @@ -15543,7 +15551,6 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): # Horizontal scrollbar if element.HorizontalScroll: - element.TKText.config(wrap='none') _make_ttk_scrollbar(element, 'h', toplevel_form) element.hsb.pack(side=tk.BOTTOM, fill='x') element.Widget.configure(xscrollcommand=element.hsb.set) @@ -17738,7 +17745,7 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ suppress_error_popups=None, suppress_raise_key_errors=None, suppress_key_guessing=None,warn_button_key_duplicates=False, enable_treeview_869_patch=None, enable_mac_notitlebar_patch=None, use_custom_titlebar=None, titlebar_background_color=None, titlebar_text_color=None, titlebar_font=None, titlebar_icon=None, user_settings_path=None, pysimplegui_settings_path=None, pysimplegui_settings_filename=None, keep_on_top=None, dpi_awareness=None, scaling=None, disable_modal_windows=None, force_modal_windows=None, tooltip_offset=(None, None), - sbar_trough_color=None, sbar_background_color=None, sbar_arrow_color=None, sbar_width=None, sbar_arrow_width=None, sbar_frame_color=None, sbar_relief=None): + sbar_trough_color=None, sbar_background_color=None, sbar_arrow_color=None, sbar_width=None, sbar_arrow_width=None, sbar_frame_color=None, sbar_relief=None, alpha_channel=None): """ :param icon: Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's :type icon: bytes | str @@ -17865,6 +17872,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ :param sbar_frame_color: Scrollbar Color of frame around scrollbar (available only on some ttk themes) :type sbar_frame_color: (str) :param sbar_relief: Scrollbar relief that will be used for the "thumb" of the scrollbar (the thing you grab that slides). Should be a constant that is defined at starting with "RELIEF_" - RELIEF_RAISED, RELIEF_SUNKEN, RELIEF_FLAT, RELIEF_RIDGE, RELIEF_GROOVE, RELIEF_SOLID + :param alpha_channel Default alpha channel to be used on all windows + :type alpha_channel (float) :type sbar_relief: (str) :return: None :rtype: None @@ -17924,6 +17933,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ global DEFAULT_MODAL_WINDOWS_ENABLED global DEFAULT_MODAL_WINDOWS_FORCED global DEFAULT_TOOLTIP_OFFSET + global DEFAULT_ALPHA_CHANNEL + global _pysimplegui_user_settings global ttk_part_overrides_from_options # global _my_windows @@ -18109,6 +18120,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_ if tooltip_offset != (None, None): DEFAULT_TOOLTIP_OFFSET = tooltip_offset + if alpha_channel is not None: + DEFAULT_ALPHA_CHANNEL = alpha_channel # ---------------- ttk scrollbar section ---------------- if sbar_background_color is not None: @@ -22254,7 +22267,8 @@ available to make this process more atuomatic. # Dictionary of Mac Patches. Used to find the key in the global settings and the default value MAC_PATCH_DICT = {'Enable No Titlebar Patch' : ('-mac feature enable no titlebar patch-', False), 'Disable Modal Windows' : ('-mac feature disable modal windows-', True), - 'Disable Grab Anywhere with Titlebar' : ('-mac feature disable grab anywhere with titlebar-', True)} + 'Disable Grab Anywhere with Titlebar' : ('-mac feature disable grab anywhere with titlebar-', True), + 'Set Alpha Channel to 0.99 for MacOS >= 12.3' : ('-mac feature disable Alpha 0.99', True)} def _read_mac_global_settings(): """ @@ -22265,6 +22279,7 @@ def _read_mac_global_settings(): global ENABLE_MAC_MODAL_DISABLE_PATCH global ENABLE_MAC_NOTITLEBAR_PATCH global ENABLE_MAC_DISABLE_GRAB_ANYWHERE_WITH_TITLEBAR + global ENABLE_MAC_ALPHA_99_PATCH ENABLE_MAC_MODAL_DISABLE_PATCH = pysimplegui_user_settings.get(MAC_PATCH_DICT['Disable Modal Windows'][0], MAC_PATCH_DICT['Disable Modal Windows'][1]) @@ -22272,7 +22287,8 @@ def _read_mac_global_settings(): MAC_PATCH_DICT['Enable No Titlebar Patch'][1]) ENABLE_MAC_DISABLE_GRAB_ANYWHERE_WITH_TITLEBAR = pysimplegui_user_settings.get(MAC_PATCH_DICT['Disable Grab Anywhere with Titlebar'][0], MAC_PATCH_DICT['Disable Grab Anywhere with Titlebar'][1]) - + ENABLE_MAC_ALPHA_99_PATCH = pysimplegui_user_settings.get(MAC_PATCH_DICT['Set Alpha Channel to 0.99 for MacOS >= 12.3'][0], + MAC_PATCH_DICT['Set Alpha Channel to 0.99 for MacOS >= 12.3'][1]) def _mac_should_apply_notitlebar_patch(): """ @@ -22295,6 +22311,28 @@ def _mac_should_apply_notitlebar_patch(): return False +def _mac_should_set_alpha_to_99(): + + if not running_mac(): + return False + + if not ENABLE_MAC_ALPHA_99_PATCH: + return False + + # At this point, we're running a Mac and the alpha patch is enabled + # Final check is to see if Mac OS version is 12.3 or later + try: + platform_mac_ver = platform.mac_ver()[0] + mac_ver = platform_mac_ver.split('.') if '.' in platform_mac_ver else (platform_mac_ver, 0) + if (int(mac_ver[0]) >= 12 and int(mac_ver[1]) >= 3) or int(mac_ver[0]) >= 13 : + print("Mac OS Version is {} and patch enabled so applying the patch".format(platform_mac_ver)) + return True + except Exception as e: + warnings.warn('_mac_should_seet_alpha_to_99 Exception while trying check mac_ver. Error = {}'.format(e), UserWarning) + return False + + return False + def main_mac_feature_control(): """ @@ -24813,6 +24851,10 @@ if running_windows(): _read_mac_global_settings() + +if _mac_should_set_alpha_to_99(): + print('Applyting Mac OS 12.3+ Alpha Channel fix. Your default Alpha Channel is now 0.99') + set_options(alpha_channel=0.99) # if running_mac(): # print('Your Mac patches are:') # print('Modal windows disabled:', ENABLE_MAC_MODAL_DISABLE_PATCH)