Browse Source

Added a cast to string for the Dropdown default and choices values.

This allows using any printable object as choices list (some kings of Enums for instance), which is allowed by argparse but not by wxPython.
1.0.4-release-candidate
Nathan Richard 5 years ago
committed by Chris
parent
commit
e35755d121
1 changed files with 3 additions and 2 deletions
  1. 5
      gooey/gui/components/widgets/dropdown.py

5
gooey/gui/components/widgets/dropdown.py

@ -12,8 +12,9 @@ class Dropdown(TextContainer):
return wx.ComboBox(
parent=parent,
id=-1,
value=default,
choices=[default] + self._meta['choices'],
# str conversion allows using stringyfiable values in addition to pure strings
value=str(default),
choices=[str(default)] + [str(choice) for choice in self._meta['choices']],
style=wx.CB_DROPDOWN)
def setOptions(self, options):

Loading…
Cancel
Save