FileDialog default directory reset to current directory

Rob McMullen rob.mcmullen at gmail.com
Sat Feb 24 09:27:58 PST 2007


On GTK using the wx.FileDialog in wx.SAVE mode, it seems that the
defaultDir is ignored and set to the current directory if the
defaultFile is set to non-empty string.  E.g. this

        dlg = wx.FileDialog(
            self, message="Save file as ...", defaultDir="/tmp",
            defaultFile="blah", wildcard=wildcard, style=wx.SAVE
            )

results in the dialog showing the current directory, but this:

        dlg = wx.FileDialog(
            self, message="Save file as ...", defaultDir="/tmp",
            defaultFile="", wildcard=wildcard, style=wx.SAVE
            )

will show the dialog in the /tmp directory.

I did find it could be worked around by following the dialog creation with:

dlg.SetDirectory("/tmp")

Rob




More information about the wxpython-dev mailing list