473,320 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

tkFileDialog.askdirectory root directory ?

Hello!

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?

Thank you in advance for any hints.

Best wishes,

Niki
Jul 18 '05 #1
2 2901
Ringwraith wrote:
Hello!

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?

Thank you in advance for any hints.

Best wishes,

Niki


Unles there is a speacial windows extra thingy I don't think you could
stop the user selecting a directory not below C:/my_app however you can
at least start the directory selector with that as it's initial
directory like so:
tkFileDialog.askdirectory(initialdir="C:/my_app")
HTH
Martin

Jul 18 '05 #2
In article <c2**********@atlantis.news.tpi.pl>,
"Ringwraith" <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
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rv! | last post by:
I've posted this onto alt.php earlier and stumped all involved. I didn't cross post for the usual reasons Anyone here got any ideas? -------------------------------------- I am simply...
1
by: Mike Abel | last post by:
Hello i have a Linux Mandrake Distribution with Python 2.3 and Tcl/Tk 8.4. Python 2.2 and Tcl/Tk 8.3.3 returns an String if i made this: x = tkFileDialog.askdirectory(initialdir="was auch...
2
by: Read Roberts | last post by:
I have the current Windows binary install of Python 2.3.4 on my Windows XP system. I am pained to discover that tkFileDialog.askdirectory() returns a mangled path when a directory is selected...
1
by: Matt Leslie | last post by:
Hi, I am trying to install python 2.4.1 on a windows XP machine. Whether I choose to install 'for me' or 'for all users, and no matter where I select as the root directory, the installer always...
2
by: news.sbcglobal.net | last post by:
I hope I can explain this well enough to understand. I have a master page that is used by almost all of the pages in my site. On the master page is a table. In one of the cells in this table, I...
3
by: Chris | last post by:
I have created a site with VS2005, using asp.net/c#. When I try to deploy this site to our intranet asp server all of my links that were "~/Folder/Site.aspx" no longer work because when I move it...
1
by: Ryan Liu | last post by:
Hi, I have multiple C# solutions and they share some utility and generic projects. I put all *.sln files in root directory. File structure is like this( things without ext is a folder): ...
7
by: Arthur | last post by:
hi, this might be a simple one to them who know: i'm developing an asp.net project and use the debug mode. i have a xml file which contains data, that shall be read, if a specific page is...
11
by: Jivanmukta | last post by:
Hello, I am learning PHP5. I need to obtain my website's root directory in .php code. I tried the code: echo __DIR__, $_SERVER; but it displays: __DIR__/var/www/html although my_website is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.