Question on creating Tkinter Widgets

klappnase klappnase at web.de
Tue Apr 27 05:37:06 EDT 2004


"Adonis" <adonisv at REMTHISearthlink.net> wrote in message news:<jcijc.3852$g31.1644 at newsread2.news.atl.earthlink.net>...
> 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

So far this sounds perfectly "proper" to me.
Usually when I create my own widgets it looks like:

class Mywidget(Tkinter.Frame):
    def __init__(self, master, special_attribute='default', *args, **kw):
        Tkinter.Frame.__init__(self, master, *args, **kw)
        <widget's contents......>

    def widget_method1(self):
        <.......>

(etc.)

Sounds like you are doing quite the same.

Regards

Michael



More information about the Python-list mailing list