Re: [wxPython-users] wx.DirDialog on MacOSX

38 views
Skip to first unread message

Robin Dunn

unread,
Nov 8, 2012, 8:14:46 PM11/8/12
to wxpytho...@googlegroups.com
On 11/7/12 10:36 AM, nosirfur wrote:
> Hi,
>
> I am new in this group and a wx-beginner.
> I had a look on the old posts about wx.DirDialog issues but I could not
> find a solution for the following problem I have.
>
> The small piece of code attached below should (in my intention) tell the
> system to change directory to the "_selectedDir" folder.
> In the following part of the code (not shown) some commands should be
> executed in the folder "_selectedDir" which contains some input files.
> The code does work on Linux (the system changes directory, inputs are
> found and commands properly executed).
> But the code does NOT work on MacOSX since I get an error message
> stating that the input files cannot be found. I did some cross check
> printing out the 'pwd' and I find that the directory did not change.
>
> "
> def SetDir(self,event):
> dialog = wx.DirDialog(self, "Please choose your project directory:",\
> defaultPath=userPath,style=wx.DD_CHANGE_DIR , pos = (10,10))
> if dialog.ShowModal() == wx.ID_OK:
> _selectedDir = dialog.GetPath()
> return _selectedDir
> else:
> _userCancel = dialog.Destroy()
> return _userCancel
> dialog.Destroy()
> "
> Maybe my code is not properly written?

What version of wxPython? If 2.9.x then are you using the carbon or the
cocoa build?

Of course there is an easy workaround, you can just call
os.chdir(_selectedDir) yourself.

--
Robin Dunn
Software Craftsman
http://wxPython.org

nosirfur

unread,
Nov 9, 2012, 2:30:48 AM11/9/12
to wxpytho...@googlegroups.com
Hi

Thank you for the reply.
I'm using wxPython2.9-osx-2.9.4.0-cocoa-py2.7.

Anyhow the"os.chdir(_selectedDir)" works.
Thanks!
Reply all
Reply to author
Forward
0 new messages