Question on creating Tkinter Widgets

Eric Brunel eric_brunel at despammed.com
Tue Apr 27 03:59:17 EDT 2004


Adonis wrote:
> I am creating some widgets by inheriting from Tkinter.Frame and populating
> the frame with whatever the widget will be then creating certain
> attributes/methods to be accessed later. My question is, is this a poper way
> to create widgets or should I take a different approach?
> 
> Any help is greatly appreciated.
> 
> Adonis

Most Tkinter "megawidgets" are created by either specializing Tkinter.Frame or 
Tkinter.Canvas, so it seems to be the way to go. It has at least a major 
advantage: the widgets you create directly inherit the basic behaviour of all 
Tkinter widgets, so you can directly pack them, grid them, or whatever else, 
without having a single line of code to write. I made some Tkinter widgets 
myself and always used this approach; up to this time, it worked pretty well.

HTH
-- 
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com




More information about the Python-list mailing list