From 1f95394a9d444ecf6d539cb978053fca038327a5 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Tue, 16 Jun 2020 13:19:09 -0400 Subject: [PATCH] Added Radio.reset_group --- PySimpleGUIQt/PySimpleGUIQt.py | 12 +++++++++--- PySimpleGUIWx/PySimpleGUIWx.py | 7 +++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/PySimpleGUIQt/PySimpleGUIQt.py b/PySimpleGUIQt/PySimpleGUIQt.py index 2a01c778..68ac7991 100644 --- a/PySimpleGUIQt/PySimpleGUIQt.py +++ b/PySimpleGUIQt/PySimpleGUIQt.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "0.35.0.3 Unreleased\nMassive update of docstrings (thanks nngogol), default for slider tick interval set automatically now, margins added to Window but not yet hooked up, VSeparator added (spelling error)" +version = __version__ = "0.35.0.4 Unreleased\nMassive update of docstrings (thanks nngogol), default for slider tick interval set automatically now, margins added to Window but not yet hooked up, VSeparator added (spelling error), added Radio.reset_group and removed clearing all when one of them is cleared (recent change)" port = 'PySimpleGUIQt' @@ -933,14 +933,20 @@ class Radio(Element): self.QT_Radio_Button.setDisabled(False) if value is True: self.QT_Radio_Button.setChecked(True) - if value is False: # If setting this button to false, then set them ALL to false too - self.QT_Radio_Button.setChecked(True) + if value is False: self.QT_RadioButtonGroup.setExclusive(False) self.QT_Radio_Button.setChecked(False) self.QT_RadioButtonGroup.setExclusive(True) super().Update(self.QT_Radio_Button, background_color=background_color, text_color=text_color, font=font, visible=visible) + def reset_group(self): + self.QT_Radio_Button.setChecked(True) + self.QT_RadioButtonGroup.setExclusive(False) + self.QT_Radio_Button.setChecked(False) + self.QT_RadioButtonGroup.setExclusive(True) + + def _QtCallbackValueChanged(self, value): if not self.ChangeSubmits: return diff --git a/PySimpleGUIWx/PySimpleGUIWx.py b/PySimpleGUIWx/PySimpleGUIWx.py index d6586322..cd20d5c1 100644 --- a/PySimpleGUIWx/PySimpleGUIWx.py +++ b/PySimpleGUIWx/PySimpleGUIWx.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "0.17.1.1 Unreleased\n VSeparator added (spelling error)" +version = __version__ = "0.17.1.2 Unreleased\n VSeparator added (spelling error), Radio.reset_group added and removed the clearing all when one cleared" port = 'PySimpleGUIWx' @@ -806,11 +806,14 @@ class Radio(Element): if value is True: self.WxRadioButton.SetValue(True) elif value is False: - self.WxRadioButton.SetValue(True) self.WxRadioButton.SetValue(False) super().Update(self.WxRadioButton, background_color=background_color, text_color=text_color, font=font, visible=visible) + def reset_group(self): + self.WxRadioButton.SetValue(True) + self.WxRadioButton.SetValue(False) + update = Update # ---------------------------------------------------------------------- #