Release 4.24.0 - addition of new set_options parameter to control patching of treeview color problem for tk 8.6.9

This commit is contained in:
PySimpleGUI 2020-07-03 15:05:26 -04:00
parent 10ec39bc85
commit 3fbdf1ffe4
4 changed files with 39 additions and 9 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.23.0 Released 3-Jul-2020" version = __version__ = "4.24.0 Released 3-Jul-2020"
port = 'PySimpleGUI' port = 'PySimpleGUI'
@ -401,6 +401,8 @@ ENABLE_TK_WINDOWS = False
SUPPRESS_ERROR_POPUPS = False SUPPRESS_ERROR_POPUPS = False
ENABLE_TREEVIEW_869_PATCH = False
# ====================================================================== # # ====================================================================== #
# One-liner functions that are handy as f_ck # # One-liner functions that are handy as f_ck #
# ====================================================================== # # ====================================================================== #
@ -11372,9 +11374,11 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
element.TKRightClickMenu = top_menu element.TKRightClickMenu = top_menu
element.TKTreeview.bind('<Button-3>', element._RightClickMenuCallback) element.TKTreeview.bind('<Button-3>', element._RightClickMenuCallback)
if tclversion_detailed == '8.6.9': if tclversion_detailed == '8.6.9' and ENABLE_TREEVIEW_869_PATCH:
print('*** tk version 8.6.9 detected.... patching ttk treeview code ***') print('*** tk version 8.6.9 detected.... patching ttk treeview code ***')
table_style.map(style_name, foreground=_fixed_map(table_style, style_name, 'foreground'), background=_fixed_map(table_style, style_name, 'background')) table_style.map(style_name,
foreground=_fixed_map(table_style, style_name, 'foreground'),
background=_fixed_map(table_style, style_name, 'background'),)
# ------------------------- Tree placement element ------------------------- # # ------------------------- Tree placement element ------------------------- #
elif element_type == ELEM_TYPE_TREE: elif element_type == ELEM_TYPE_TREE:
@ -11489,9 +11493,14 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
AddMenuItem(top_menu, menu[1], element) AddMenuItem(top_menu, menu[1], element)
element.TKRightClickMenu = top_menu element.TKRightClickMenu = top_menu
element.TKTreeview.bind('<Button-3>', element._RightClickMenuCallback) element.TKTreeview.bind('<Button-3>', element._RightClickMenuCallback)
if tclversion_detailed == '8.6.9': if tclversion_detailed == '8.6.9' and ENABLE_TREEVIEW_869_PATCH:
print('*** tk version 8.6.9 detected.... patching ttk treeview code ***') print('*** tk version 8.6.9 detected.... patching ttk treeview code ***')
tree_style.map(style_name, foreground=_fixed_map(tree_style, style_name, 'foreground'), background=_fixed_map(tree_style, style_name, 'background')) tree_style.map(style_name,
foreground=_fixed_map(tree_style, style_name, 'foreground'),
background=_fixed_map(tree_style, style_name, 'background'),
)
# ------------------------- Separator placement element ------------------------- # # ------------------------- Separator placement element ------------------------- #
elif element_type == ELEM_TYPE_SEPARATOR: elif element_type == ELEM_TYPE_SEPARATOR:
@ -12359,7 +12368,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None, None), button_e
text_justification=None, background_color=None, element_background_color=None, text_justification=None, background_color=None, element_background_color=None,
text_element_background_color=None, input_elements_background_color=None, input_text_color=None, text_element_background_color=None, input_elements_background_color=None, input_text_color=None,
scrollbar_color=None, text_color=None, element_text_color=None, debug_win_size=(None, None), scrollbar_color=None, text_color=None, element_text_color=None, debug_win_size=(None, None),
window_location=(None, None), error_button_color=(None, None), tooltip_time=None, tooltip_font=None, use_ttk_buttons=None, ttk_theme=None, suppress_error_popups=None): window_location=(None, None), error_button_color=(None, None), tooltip_time=None, tooltip_font=None, use_ttk_buttons=None, ttk_theme=None, suppress_error_popups=None, enable_treeview_869_patch=None):
""" """
:param icon: filename or base64 string to be used for the window's icon :param icon: filename or base64 string to be used for the window's icon
:type icon: Union[bytes, str] :type icon: Union[bytes, str]
@ -12476,6 +12485,7 @@ def SetOptions(icon=None, button_color=None, element_size=(None, None), button_e
global USE_TTK_BUTTONS global USE_TTK_BUTTONS
global TOOLTIP_FONT global TOOLTIP_FONT
global SUPPRESS_ERROR_POPUPS global SUPPRESS_ERROR_POPUPS
global ENABLE_TREEVIEW_869_PATCH
# global _my_windows # global _my_windows
if icon: if icon:
@ -12591,6 +12601,9 @@ def SetOptions(icon=None, button_color=None, element_size=(None, None), button_e
if suppress_error_popups is not None: if suppress_error_popups is not None:
SUPPRESS_ERROR_POPUPS = suppress_error_popups SUPPRESS_ERROR_POPUPS = suppress_error_popups
if enable_treeview_869_patch is not None:
ENABLE_TREEVIEW_869_PATCH = enable_treeview_869_patch
return True return True
# ----------------------------------------------------------------- # # ----------------------------------------------------------------- #
@ -16585,7 +16598,6 @@ if __name__ == '__main__':
if len(sys.argv) > 1 and sys.argv[1] == 'upgrade': if len(sys.argv) > 1 and sys.argv[1] == 'upgrade':
_upgrade_gui() _upgrade_gui()
exit(0) exit(0)
main() main()
exit(0) exit(0)

View File

@ -14495,7 +14495,8 @@ set_options(icon=None,
tooltip_font=None, tooltip_font=None,
use_ttk_buttons=None, use_ttk_buttons=None,
ttk_theme=None, ttk_theme=None,
suppress_error_popups=None) suppress_error_popups=None,
enable_treeview_869_patch=None)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -14594,7 +14595,8 @@ SetOptions(icon=None,
tooltip_font=None, tooltip_font=None,
use_ttk_buttons=None, use_ttk_buttons=None,
ttk_theme=None, ttk_theme=None,
suppress_error_popups=None) suppress_error_popups=None,
enable_treeview_869_patch=None)
``` ```
Parameter Descriptions: Parameter Descriptions:

View File

@ -7314,6 +7314,14 @@ popup extensions
* a few new built-in icons * a few new built-in icons
## 4.24.0 PySimpleGUI 3-Jul-2020
Selective control over tk 8.6.9 treeview color patch
* Disabled the code that patched the problem with background colors for Tree and Table elements
* Can enable the patched code by calling set_options
* To enable set parameter enable_treeview_869_patch = True (defaults to false)
### Upcoming ### Upcoming
There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway. There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway.

View File

@ -7314,6 +7314,14 @@ popup extensions
* a few new built-in icons * a few new built-in icons
## 4.24.0 PySimpleGUI 3-Jul-2020
Selective control over tk 8.6.9 treeview color patch
* Disabled the code that patched the problem with background colors for Tree and Table elements
* Can enable the patched code by calling set_options
* To enable set parameter enable_treeview_869_patch = True (defaults to false)
### Upcoming ### Upcoming
There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway. There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway.