wx.DirDialog closes instantly on mac (when no MainLoop exists)

Hi guys ! My friends and I have been working on a scientific software for plotting star data for months, and are almost ready to release. As such, we’re ironing out the last bugs. The last big problem we had is that on OSX (maverick, at the least), wx.DirDialog opens and closes immediately at ShowModal() when there is no application MainLoop.

import wx

app = wx.App(False)

openFileDialog = wx.DirDialog(None, “Select data folder”)

openFileDialog.ShowModal()

In windows and linux, this works fine and we store the fetched path into a variable for use in another module. The reason we don’t do an app main loop is because this runs immediately, before opening up the main part of the software and that’s all we need it for. To get around the problem, I set up this code:

import wx

app = wx.App(False)

class Frame(wx.Frame):

def init(self, title):

wx.Frame.init(self, None, title=title, size=(1,1))

self.timer = wx.Timer(self)

self.Bind(wx.EVT_TIMER, self.OnTimer)

self.timer.Start(1, True)

def OnTimer(self,evt):

self.Close()

frame=Frame(“Opening Directory Selector”)

frame.Show()

app.MainLoop()

openFileDialog = wx.DirDialog(None,“Select data folder”)

openFileDialog.ShowModal()

This fix will probably be sufficient, but I wanted to bring this to attention in case there is a simple way to fix it. Thanks and it’s been a pleasure learning wxPython !!!