From 0d94e19c815133a23d2f2bb4bff34653f819648c Mon Sep 17 00:00:00 2001 From: Joaquin Santos Date: Thu, 8 Oct 2015 18:09:58 -0700 Subject: [PATCH] Set default state in a CheckBox --- gooey/gui/widgets/components.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gooey/gui/widgets/components.py b/gooey/gui/widgets/components.py index e6b953c..95deb3b 100644 --- a/gooey/gui/widgets/components.py +++ b/gooey/gui/widgets/components.py @@ -112,6 +112,7 @@ class CheckBox(BaseGuiComponent): self.widget = None # data self.option_strings = data['commands'][0] + self.default_value = bool(data['default']) def build(self, parent): return self.do_layout(parent) @@ -120,6 +121,7 @@ class CheckBox(BaseGuiComponent): self.panel = wx.Panel(parent) self.widget = wx.CheckBox(self.panel) + self.widget.SetValue(self.default_value) self.title = self.createTitle(self.panel) self.help_msg = self.createHelpMsgWidget(self.panel) self.help_msg.SetMinSize((0, -1)) @@ -218,7 +220,7 @@ class RadioGroup(object): def GetValue(self): vals = [button.GetValue() for button in self.radio_buttons] try: - return self.option_stings[vals.index(True)][0] + return self.option_strings[vals.index(True)][0] except: return ''