[Tutor] working with Tkinter

alan.gauld@bt.com alan.gauld@bt.com
Thu, 25 Apr 2002 17:51:03 +0100


> I'm working out a small program with Tkinter that has an 
> initial dialog with many buttons calling many dialogs 
> with many buttons calling more dialogs.
> 
> My problem is about the code, it looks like spaghetti. 

This is why, once you go beyond small examples, GUIs are 
usually written in an OO style.

A class for each dialog type with the button event handlers 
as methods of the class. Put each class in a module to 
further separate things. The dialog classes should inherit 
from TopLevel in Tkinter.

HTH,

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld