[Tutor] Wizards in Tkinter

Alan G alan.gauld at freenet.co.uk
Wed May 25 00:28:49 CEST 2005


Your mail came as an attachment so no quoted text, but basically 
there are two approaches to your problem of a Wizard.

In Tkinter you normally use a Frame as your main window.
You can pack another Frame inside that frame with your content.
When you press next simply unpack frame 1 and pack frame 2.
Repeat for as many frames as your Wizard requires. (This
makes going back easy too...)

A second approach is to use TopLevel widgets which are 
normally used for modeless dialog boxes. These effctively 
have their own mainloop running in parallel wit the main 
window but in a controlled way. But creating lors of 
TopLevel "dialogs" is IMHO resource hungry and harder 
work than using multiple frames.

The Frame approach also has the advantage that you can, 
to a degree data drive the wizard by putting references 
to the Frames in a dictionary or list and stepping through
the sequence. That way you can easily change the sequence, 
reuse frames over again within the same wizard etc etc.

Hope that made sense,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list