[Tutor] Multiple Tk frames

Hazlett, Les les.hazlett at navteq.com
Tue Feb 13 21:48:43 CET 2007


Hi,

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.  

Below is a "cut-down" version of what I have tried.

Thanks for any help,

Les Hazlett

=====================

# Test using TK

from Tkinter import *

class Window1(Frame):
    def __init__(self, master):
        Frame.__init__(self, master)
        self.grid()
        self.create_widgets()

    def create_widgets(self):
     # create a quit button
        Button(self,
               text = "Quit",
               command = self.quit
               ).grid(row = 10, column = 1)

# main
root = Tk()
root.title("Portable Disk Upload")
app = Window1(root)
root.mainloop()

print '\nWanted to stop here and do it again.'

root = Tk()
root.title("Select Source Directory")
app = Window1(root)
root.mainloop



The information contained in this communication may be CONFIDENTIAL and is intended only for the use of the recipient(s) named above. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please notify the sender and delete/destroy the original message and any copy of it from your computer or paper files.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070213/7c0a4435/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 145 bytes
Desc: Blank Bkgrd.gif
Url : http://mail.python.org/pipermail/tutor/attachments/20070213/7c0a4435/attachment-0001.gif 


More information about the Tutor mailing list