473,396 Members | 2,029 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,396 software developers and data experts.

tkFileDialog.askopenfilename filetypes problem

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 followed by its traceback.

def do_ask_fn_1():
z = askopenfilename(title=TITLE, initialdir=Dst_Dir,
filetypes=(('AIFF Files','*.aiff'),
("AU Files", "*.au"),
("RAW Files", "*.raw"),
("SD Files", "*.sd"),
("SND Files", "*.snd"),
("WAV files", "*.wav")
)
)
print z
Exception in Tkinter callback
Traceback (most recent call last):
File "E:\PYTHON~1\lib\lib-tk\Tkinter.py", line 1345, in __call__
return self.func(*args)
File "P:\work\Python\PYZoid\PYZoid.pyw", line 213, in do_ask_fn_1
filetypes=[('AIFF Files','*.aiff'),
TypeError: askopenfilename() takes exactly 0 non-keyword arguments (1 given)

Can anyone point to what Ive done wrong? Thanks for any input.

Justin
Jul 21 '05 #1
1 7798
For me this:

z = tkFileDialog.askopenfilename(title='Title',
filetypes=[
('AIFF Files','*.aiff'),
("TXT Files", "*.txt"),
],
initialdir=InputDir)
print z

works fine.
Eugene

"Justin Straube" <Ju***********@notmymailbox.com> wrote in message
news:X3****************@fe07.lga...
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 followed by its traceback.

def do_ask_fn_1():
z = askopenfilename(title=TITLE, initialdir=Dst_Dir,
filetypes=(('AIFF Files','*.aiff'),
("AU Files", "*.au"),
("RAW Files", "*.raw"),
("SD Files", "*.sd"),
("SND Files", "*.snd"),
("WAV files", "*.wav")
)
)
print z
Exception in Tkinter callback
Traceback (most recent call last):
File "E:\PYTHON~1\lib\lib-tk\Tkinter.py", line 1345, in __call__
return self.func(*args)
File "P:\work\Python\PYZoid\PYZoid.pyw", line 213, in do_ask_fn_1
filetypes=[('AIFF Files','*.aiff'),
TypeError: askopenfilename() takes exactly 0 non-keyword arguments (1 given)
Can anyone point to what Ive done wrong? Thanks for any input.

Justin

Jul 21 '05 #2

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

Similar topics

2
by: Stephen Boulet | last post by:
I'm using the following code to get a file name: import tkFileDialog tkFileDialog.askopenfilename(filetypes=) How can I do this without an empty tk window popping up and hanging around after...
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...
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: imphasing | last post by:
I'm writing a python program to open a file, and display it onscreen, but I can't seem to find the var that "tkOpenFileName" returns to. It's not much use if you can't get the filename you just...
3
by: jaime.suarez | last post by:
I am creating a very simple GUI with one Entry widget and one Button. The purpose of the Button widget is to Browse for a file using tkFileDialog.askopenfilename(). I bind the button to a...
4
by: mdmdmd | last post by:
Hello, I wish to collect 4 files from a user. So I have decided to use tkFileDialog askopenfilename. My problem is that after a few file selections the root window is destroyed (the whole...
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...
0
by: Matthias Huening | last post by:
Hi, I have problems using tkFileDialog under Linux (Ubuntu 8.04 in my case, but other Linuxes seem to show the same behaviour). The following works fine: import tkFileDialog f =...
0
by: Leonhard Vogt | last post by:
Hello I have the following problem in Python 2.5 on Windows XP. On Ubuntu I do not see the problem. I have a Tkinter application as in the following example The entry-widget is somehow...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.