A short while ago someone posted that(unlike the examples) you should 
use Tk as the base for your main window in tkinter apps, not Frame.   Thus :

   class MyMain(Frame):
           def __init__(self, master):
               self.root = master
               self.master=master
               self.createWidgets()
           def createWidgets():
                ...
       root = Tk()
       app = MyMain(root)
       app.master.title("Object Editor")
       root.mainloop()

would become:

    class MyMain(Tk):
       ...
       ...
    app = MyMain()
    app.title("My App")
    app.mainloop()

When I try converting to this approach I run into a problem with the 
__init__() method.  It appears to go into an infinite loop in 
tkinter.__getattr__().

If I omit __init__() I get a properly titled window, but must explicitly 
call my createWidgets method from __main__.

    class MyMain(Tk):
       createWidgets()
         ...
       ...

    app = MyMain()
    app.title("My App")
    app.createWidgets()
    app.mainloop()

Am I missing something?

Bill
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to