Fix for ColorChooser Button filling in None when dialog is cancelled

This commit is contained in:
PySimpleGUI 2022-06-24 09:15:05 -04:00
parent 2f706252a0
commit 73d65ffdc1
1 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.60.0.49 Unreleased" version = __version__ = "4.60.0.50 Unreleased"
_change_log = """ _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
@ -122,6 +122,8 @@ _change_log = """
4.60.0.49 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 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 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
""" """
@ -4964,6 +4966,7 @@ class Button(Element):
elif self.BType == BUTTON_TYPE_COLOR_CHOOSER: 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 = 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 color = color[1] # save only the #RRGGBB portion
if color is not None:
strvar.set(color) strvar.set(color)
self.TKStringVar.set(color) self.TKStringVar.set(color)
elif self.BType == BUTTON_TYPE_BROWSE_FILES: elif self.BType == BUTTON_TYPE_BROWSE_FILES: