On 14/02/07, Hazlett, Les <[EMAIL PROTECTED]> wrote:
> I have found many simple examples of using Tk with one frame.  I found
> self.quit to close the open frame object.  I see that control goes to the
> end of main, but I don't know how to then create and use another frame.

Hi Les,

In Tkinter parlance, a "Frame" is a container that you use to build up
a window.  Is that what you're after, or do you want to make multiple
windows?

When you call Tk(), it does two things:
 1. it creates a top level window that you can put things into
 2. it creates and initialises the Tk engine.

You only need to do (2) once, so you only need to call Tk() once.  If
you want more than one top level window, you need to use Toplevel().

eg:

from Tkinter import *

root = Tk()
root.title("Main window")
lab1 = Label(root, text="This is the main window")
lab1.pack()

otherWindow = Toplevel()
otherWindow.title("Other window")
lab2 = Label(otherWindow, text="This is the other window")
lab2.pack()

root.mainloop()

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to