[Tutor] Pattern for using multiple windows in Tkinter

The Green Tea Leaf thegreentealeaf at gmail.com
Mon May 3 19:10:03 CEST 2010


I've just started to play with Tkinter and can't really figure out the
typical pattern of creating an app with several windows - I tried to
find some resources on the web but failed to find how to do this. Here
is an attempt to explain using code

class MyWindowClass:
  def __init__(self):
    self._window = Toplevel() # Is this the correct pattern for
creating new windows??
    ...

first = MyWindowClass()
second = MyWindowClass()

This works but it also creates the "root" window ...

What is the "correct" way of coding an app where I define a class that
represents one window and where I want to be able to open multiple
windows of that class.

I hope you understand my question :)

-- 
The Green Tea Leaf   thegreentealeaf at gmail.com   thegreentealeaf.blogspot.com


More information about the Tutor mailing list