Tkinter menus

Gigs_ gigs at hi.t-com.hr
Thu Mar 1 13:34:42 EST 2007


class MenuDemo(Frame):
     def __init__(self, parent=None):
         Frame.__init__(self, parent)
         self.pack(expand=YES, fill=BOTH)
         self.createWidgets()

     def createWidgets(self):
         self.makeMenuBar()
         self.makeToolBar()
         L = Label(self, text='Menu and Toolbar demo')
         L.config(relief=SUNKEN, width=40, height=10, bg='white')
         L.pack(expand=YES, fill=BOTH)

     def makeMenuBar(self):
         self.menubar = Menu(self.master)        #here
         self.master.config(menu=self.menubar)   #here
         self.fileMenu()
         self.editMenu()
         self.imageMenu()

why i need to use self.master?
why i cant just use self?

thx



More information about the Python-list mailing list