From 6e9ebe0a81769228f63ede218e3a415a61c86305 Mon Sep 17 00:00:00 2001 From: Nathan Richard Date: Thu, 11 Apr 2019 18:02:55 +0200 Subject: [PATCH] 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. --- gooey/gui/components/widgets/dropdown.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gooey/gui/components/widgets/dropdown.py b/gooey/gui/components/widgets/dropdown.py index 134e163..f89d6c7 100644 --- a/gooey/gui/components/widgets/dropdown.py +++ b/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):