473,232 Members | 1,519 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,232 software developers and data experts.

askopenfilename() as root window

Is there any way to open a Tkinter.askopenfilename() without opening a
root window alongside the file chooser?

I simply want a script to open a dialog and return the chosen file's
path to stdout.

"""
from tkFileDialog import askopenfilename

print askopenfilename()
"""

....does the job, but it opens that nagging root window beside it. I
tried setting parent=None to no avail. The second window always shows
up. Any ideas?

~Sean
Dec 19 '07 #1
2 3796
On 18 dic, 22:43, Sean DiZazzo <half.ital...@gmail.comwrote:
Is there any way to open a Tkinter.askopenfilename() without opening a
root window alongside the file chooser?

I simply want a script to open a dialog and return the chosen file's
path to stdout.
Yes, create the root yourself so you can call the withdraw() method:

root = Tk()
root.withdraw()
print askopenfilename()

--
Gabriel Genellina
Dec 19 '07 #2
On Dec 18, 6:06 pm, Gabriel Genellina <gagsl-...@yahoo.com.arwrote:
On 18 dic, 22:43, Sean DiZazzo <half.ital...@gmail.comwrote:
Is there any way to open a Tkinter.askopenfilename() without opening a
root window alongside the file chooser?
I simply want a script to open a dialog and return the chosen file's
path to stdout.

Yes, create the root yourself so you can call the withdraw() method:

root = Tk()
root.withdraw()
print askopenfilename()

--
Gabriel Genellina
As usual... Thank you Gabriel.
Dec 19 '07 #3

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

Similar topics

0
by: Tim Williams | last post by:
I just installed Python 2.3 on my Redhat system. When I tried to run one of my programs that use tkFileDialog.askopenfilename(), I got an error because it returns a tuple instead of a null string...
1
by: Justin Straube | last post by:
Hopefully someone can catch what im missing here. Ive googled this and I think Ive got the filetypes arg written properly, but I get a traceback when calling this function. Heres the code...
0
by: half.italian | last post by:
Hi all. I'm trying to get Tkinter.askopenfilename() to list a directory tree on a remote computer. I've got some ideas, but nothing is slapping me in the face. Can someone point me in the...
3
by: Silent1Mezzo | last post by:
file = askopenfilename(title='Open File', filetypes=) if(file != ""): This is what I have so far, the "if(file != ""): makes sure teh user doesn't press cancel. My problem is...
3
by: rahulnag22 | last post by:
Hi, When I call tkFileDialog.askopenfilename() , the dialog box opens with the current directory as the default directory. Is it possible to open the dialog box with a directory other than the...
2
by: Traclo | last post by:
Hello all! I have a problem concerning tkFileDialog. When I use the the askopenfilename command to open a text file it opens a tkinter window (apart from the file browsing window) which refuses to...
0
by: Gabriel Genellina | last post by:
En Thu, 07 Aug 2008 19:08:56 -0300, Lisa Frauens <frauens@hotmail.com> escribi�: Yes, you should save the last used directory somewhere. Try using ConfigParser. last_used_directory = ......
1
by: Lie Ryan | last post by:
On Wed, 01 Oct 2008 11:33:59 +0100, dudeja.rajat wrote: The root window is the main window, not the DOS box. I think in windows, you should use pythonw.exe or something to open the python...
4
by: gaurav kashyap | last post by:
Dear all, I am using Microsoft Windows XP.Using putty.exe,I connected to LINUX server and a terminal window gets opened.Here i logeed in as root. What i want to do is open another terminal...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
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...

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.