[Tutor] (no subject)

Blake.Garretson@dana.com Blake.Garretson@dana.com
Mon, 15 Oct 2001 13:54:05 -0400


Sharriff,

If you don't want to make them from scratch, Tkinter has some built-in file
browsers that work quite well.  Try this:

>>>import tkFileDialog
>>>file=tkFileDialog.askopenfilename(filetypes=[("My Text Files", "*.txt"),
("All Files","*")])

The variable "file" holds the file name.  The function should return None
if cancel was hit.  Also, if you look in the tkFileDialog.py source, it
shows how to set a default file name, change the window's title, and other
things.  There's also a tkFileDialog.asksaveasfilename function.

-Blake Garretson

>Date: Mon, 15 Oct 2001 12:08:46 +0200
>From: "Sharriff Aina" <nhytro-python@web.de>
>Subject: [Tutor] Tkinter File browswer
>
>Could someone show me how to code a file browser widget with Tkinter and
Pmw?