[Tutor] Mulltiple TK frames
alan.gauld at btinternet.com
Wed Feb 14 20:37:48 CET 2007
"Hazlett, Les" <les.hazlett at navteq.com> wrote
> No doubt the widow vs. frame terminology is simpe
A Window is a GUI concept, it is the thing with the
iconify/delete buttons and title bar. A Frame is literally
a container for other widgets. Its conventional to create
your Windows with a Frame as the top widget that
contains all others.
For a simple example look at the Grammer checkerr
GUI in my tutorial Case Study. It has 3 frames in a
> Knowing that I am still confused by the window vs.
> frame terminology, let me use the term "userform"
Form is common terminology in Visual Basic and
Delphi so thats not a bad term to use for a window
within an application. It encompasses both application
level windows and dialog boxes etc.
> What I want is, no doubt, ordinary. I want to display
> a "userform" asking the user to enter a folder path.
OK, That would normally be done using the standard
folder dialog. It uses the usual OS Windows style dialog
with a tree widget and returns the folder name the user
Look here for more on the common dialogs:
I'm amazed nobody has documented these in the standard library
yet. They seem to be something of a secret in the Tkinter community!
They andle the normal File-Open, File-SaveAs, Choose Folder type
tasks needed in most GUI apps.
> "Continue" button, I want to get the directory of what is inside
> tthe selected folder and show a different "userform" with check
> buttons for subordinate folders.
Couldn't you use the normal Ctrl-Click/Shift click methods of
selecting multiple folders using the standard dialogs? They can
return a list of names if you ask them to...
> second "userform", I want to do some (no need to explain) things to
> selected folders and then show a third "userform" with summary
> information about folder/file sizes and run time.
Can I suggest a different scheme?
One Form on startup, with a button, or menu option (or both) that
opens a standard chooser dialog which returns a list of folders.
That same form also has a display widget (Text maybe?) that
gets filled with the result of your processing.
This is the conventional style of GUI application and should
seem normal to your users.
> I would love to see a simple sample that uses multiple
Try the IDLE editor. It has several popup dialogs etc.
It is written in Tkinter.
> I will keep reading about Tk. What reference would
> you recommend. I have the Wesley Chun Core Python
> Programming book.
The best references are:
Fred Lundh's tutorial and reference (but doesn't cover standard
- linked from the Tkinter section on the Python web site.
The link I posted above
Grayson's book "Python & Tkinter Programming"
For generic info about building GUIs you could skim my GUI topic too,
its very thin but does cover the basics.
Author of the Learn to Program web site
More information about the Tutor