From 73d65ffdc1bcd544608cc77cef1e421a30d1dc78 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Fri, 24 Jun 2022 09:15:05 -0400 Subject: [PATCH] Fix for ColorChooser Button filling in None when dialog is cancelled --- PySimpleGUI.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index ac836e2d..61b12a2a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -version = __version__ = "4.60.0.49 Unreleased" +version = __version__ = "4.60.0.50 Unreleased" _change_log = """ Changelog since 4.60.0 released to PyPI on 8-May-2022 @@ -122,7 +122,9 @@ _change_log = """ 4.60.0.49 Added Window.set_size to match the other settings that are performed through method calls. There is also the Window.size property, but since PySimpleGUI rarely uses properties, it makes sense to include a method as well as a property - + 4.60.0.50 + Fix for ColorChooser button filling in a None value when cancel from color choise dialog box. Nothing will be filled in target if dialog cancelled + """ __version__ = version.split()[0] # For PEP 396 and PEP 345 @@ -4964,8 +4966,9 @@ class Button(Element): elif self.BType == BUTTON_TYPE_COLOR_CHOOSER: color = tk.colorchooser.askcolor(parent=self.ParentForm.TKroot, color=self.default_color) # show the 'get file' dialog box color = color[1] # save only the #RRGGBB portion - strvar.set(color) - self.TKStringVar.set(color) + if color is not None: + strvar.set(color) + self.TKStringVar.set(color) elif self.BType == BUTTON_TYPE_BROWSE_FILES: if running_mac(): # Workaround for the "*.*" issue on Mac