Frame widget (title and geometry)

Shankar Iyer (siyer@Princeton.EDU) siyer at Princeton.EDU
Fri Jun 24 20:45:21 CEST 2005


Here is an example of what I tried to do:

from Tkinter import *
import classtitle
import classtitle2

BLUE1 = '#7080B0'
RED1 = '#B08080'

class Master(Frame):

    def createWidgets(self):

        self.FrameOne = Frame(self)
        self.FrameOne.grid(sticky = NW)
        self.FrameOne["background"] = BLUE1
        self.FrameOneClassInstance = classtitle.constructor(self.FrameOne)

        self.FrameTwo = Frame(self)
        self.FrameTwo.grid(sticky = SW)
        self.FrameTwo["background"] = RED1
        self.FrameTwoClassInstance = classtitle2.constructor(self.FrameTwo)

    def __init__(self,master = None):
        Frame.__init__(self,master)
        self.pack()
        self.createWidgets()

app = Master()
app.mainloop()

The constructor methods in the two classes call, for example, self.FrameOne.geometry or self.FrameTwo.title and then I get errors which claim that these attributes do not exist.  I do think, however, that the Frame widget is what I want to use.  I want to partition my root window into several smaller sections.

Shankar    





More information about the Python-list mailing list