Hi all,
I use DirBrowseButton with wx version 2.8.10.1 (gtk2-unicode) and this is my problem: when I click on browse button and the dialog is opened, the starting directory is always the same no matter what is in the text control. But FileBrowseButton behaves differently, if there is already some file path in the text control, the dialog is opened in the directory with the file. You can use wxpython demo to check it. I couldn’t google anything related to this problem, also DirBrowseButton is not documented well. Is this behaviour a bug or a feature and can I change it somehow?
Thanks in advance,
Anna
Dne čtvrtek, 16. srpna 2012 16:48:19 UTC+2 Mike Driscoll napsal(a):
Hi Anna,
Hi all,
I use DirBrowseButton with wx version 2.8.10.1 (gtk2-unicode) and this is my problem: when I click on browse button and the dialog is opened, the starting directory is always the same no matter what is in the text control. But FileBrowseButton behaves differently, if there is already some file path in the text control, the dialog is opened in the directory with the file. You can use wxpython demo to check it. I couldn’t google anything related to this problem, also DirBrowseButton is not documented well. Is this behaviour a bug or a feature and can I change it somehow?
Thanks in advance,
Anna
I’m not sure what the DirBrowseButton is. There is no such widget that I’m aware of. Perhaps it creates and shows a wx.DirDialog? If so, that has a defaultPath parameter that can be passed to it. See the docs: http://wxpython.org/docs/api/wx.DirDialog-class.html
Basically it would look something like this:
dlg = wx.DirDialog(self, message=“Choose a directory”, defaultPath=“path/to/somewhere”, style=wx.DD_DEFAULT_STYLE)
dlg.ShowModal()
Hope that helps!
Mike
Thanks for replying. The DirBrowseButton is inherited from FileBrowseButton [1]. The advantage of this widget is that you have the label, text control and browse button together. That’s why I am using it.
Anna
[1] http://wxpython.org/docs/api/wx.lib.filebrowsebutton.DirBrowseButton-class.html
···
On Thursday, August 16, 2012 9:19:52 AM UTC-5, annakrat wrote: