tkFileDialog.askdirectory root directory ?
Russell E. Owen
no at spam.invalid
Tue Mar 2 14:45:29 EST 2004
In article <c206mk$lmi$1 at atlantis.news.tpi.pl>,
"Ringwraith" <atmo at go2.pl> wrote:
>I have the following problem. I use the tkFileDialog.askdirectory dialog to
>allow users of my application to pick some subfolder from 'C:/my_app'
>directory. I use initialdir='C:/my_app' option to set 'C:/my_app' as initial
>directory. But I want my initial directory to be also a root directory, so
>the user cannot pick any directory outside 'C:/my_app' folder. I have no
>idea how to do it using standard tkFileDialog.askdirectory. Is that
>possible?
Some possible solutions:
- Write your own version that does this, e.g. via bindings that detect
when the user tries to change directory and screens the requested
change. Unfortunately, from a quick look at tkFileDialog, I did not see
any easy way to adapt the existing code; unless I missed something you
may have to pretty much code from scratch.
- Allow the user to select anything, but then test it and reject it if
it doesn't meet your requirements. This is trivial to code, but a pain
for the user.
- See if you can redesign your code to eliminate the requirement.
-- Russell
More information about the Python-list
mailing list