diff --git a/gooey/gui/widgets/widget_pack.py b/gooey/gui/widgets/widget_pack.py index 47d259a..b4ac96d 100644 --- a/gooey/gui/widgets/widget_pack.py +++ b/gooey/gui/widgets/widget_pack.py @@ -78,7 +78,7 @@ class BaseFileChooser(BaseChooser): def onButton(self, evt): dlg = self.dialog(self.parent) - result = (dlg.GetPath() + result = (self.get_path(dlg) if dlg.ShowModal() == wx.ID_OK else None) if result: @@ -86,6 +86,13 @@ class BaseFileChooser(BaseChooser): # kinda hacky, but avoided a buncha boilerplate self.text_box.SetValue(result) + def get_path(self, dlg): + if isinstance(dlg, wx.DirDialog): + return dlg.GetPath() + else: + paths = dlg.GetPaths() + return paths[0] if len(paths) < 2 else ' '.join(paths) + def build_dialog(style, exist_constraint=True, **kwargs): if exist_constraint: