[Tutor] Closing and Open File--TkFileDialogs

Alan Gauld alan.gauld at btinternet.com
Sat Feb 7 10:38:10 CET 2009


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote

> I'm using asksaveasfilename, and, as I understand it, it returns
> the file name to me in write mode.

No it retuirns the filename. It is a string. Exactly like you would 
get
from raw_input() in a command line application. It has no "mode",
it is just a string. It is up to you to open the file in whatever mode
you require.

> While I'm at it, I have found a good example program for
> TkFileDialog methods, but the description of them on the
> internet is pretty shallow.

Thats because their functionality is pretty shallow. They open
a dialog box and return a filename, directory name or
an open file depending on which function you call and which
button you press. There is not much you can do with them
other than specify the starting folder and the title of the dialog!

> For example, An Intro to Tkinter, Lundh's Tkinter pages,

Lundh has a couple of pages on them.

http://www.pythonware.com/library/tkinter/introduction/standard-dialogs.htm

And the Tk man pages give the official documentation
but in native Tcl.- but its not hard to translate if you've read
Lundh's intro.

http://www.tcl.tk/man/tcl8.5/TkCmd/getOpenFile.htm

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list