tkFileDialog.askopenfilename filetypes problem

Eugene Druker ledruker at rogers.com
Wed Jul 13 12:49:45 EDT 2005


For me this:

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

works fine.
Eugene

"Justin Straube" <JustinStraube at notmymailbox.com> wrote in message
news:X3bBe.4979$5R1.442 at 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





More information about the Python-list mailing list