[Tutor] laying out a menu widget inside a frame

Zubin Wadia zubinw at zapdomain.ca
Thu May 11 21:03:53 CEST 2006


Hello All,

from Tkinter import *

class App:
    #create a frame
    def __init__(self, master):
        frame = Frame(master, bg="LIGHTBLUE", relief=RIDGE, bd=3)
        frame.pack(side=TOP, ipadx=15, ipady=15, fill=X)

        ##create dropdown menu

        menubar = Menu(frame)

        filemenu = Menu(menubar)
        menubar.add_cascade(label="File", menu=filemenu)
        filemenu.add_command(label="New")

        root.config(menu=menubar) ##edit

root = Tk()
root.minsize(100,100)
app = App(root)
root.mainloop()

This works great but I can't get the dropdown menu to layout in the frame
widget instead of the root. I tried frame.config() in the ##edit line but
I don't think there is a config method for the frame widget, it errors
out.

Any pointers? thanks in advance,
--zubin



More information about the Tutor mailing list