Search code examples
pythonpythoncard

Making a PythonCard File Dialog single select?


I'm working on a python application and have chosen to build the gui with PythonCard. I have need to have the user select a file to open, and in the context, selecting more than 1 file doesn't make sense. I can successfully create a file dioalog with

dialog.fileDialog(self, 'Open Input File', '', '')

And I would imagine I need to use the optional style parameter in order to get a sinlge select dialog, but I can't find an example or documentation of what I need to pass to the fifth param in order to get a single select file dialog.


Solution

  • Try setting the last line to wx.OPEN - that should be it. It seems that PythonCard specifies a dialog's main style as wx.OPEN | wx.MULTIPLE, so overriding it to just open should do the trick.