I was just wondering if anyone knows of a site or someone (or start me off with some code) that could help me with learning about cascade menu's and changing them from a parent into a child, any help would be greatly appreciated. I am making the cascade menu in Tkinter btw. Also this is only meant to be a simple screen shot so the code does not have to be completly working, i am just mainly focused apon learning to change code between a parent and child.


Well I'm actually doing some tutorials on Youtube ATM, covering lots of stuff in Tkinter. I did a vid on cascade menus but I didn't cover parent to child.

Anyway here is a link to my vids:

So ive got my cascade window down to a simple definition which pops down inside a master window

from Tkinter import *

class Application(Frame):
    def __init__(self, master=None):
        self.master = master=None
        self.menubar = Menu(self.master)

        def createMenu(self):
        self.mb = Menubutton ( self, text='FOOD MENU',
                               relief=FLAT, font=('Arial', 20))
        top.columnconfigure(0, weight=1)
        self.rowconfigure(6, weight=1)
        self.columnconfigure(0, weight=1)        
        self.mb.grid(row=6, column=0)
        self.mb.menu = Menu (self.mb, tearoff=0)
        self.mb['menu'] = self.mb.menu

        Meat = self.mb.menu.add_cascade ( label='Meat')
        self.mb.menu.add_cascade ( label='Steak')

        Seafood = self.mb.menu.add_cascade ( label='Seafood')

        Pasta = self.mb.menu.add_cascade ( label='Pasta')

        Vegitarian = self.mb.menu.add_cascade ( label='Vegitarian')

        Desserts = self.mb.menu.add_cascade ( label='Desserts')

        Beverages = self.mb.menu.add_cascade ( label='Beverages')

app = Application()
app.master.title("Major Project Sample Screen")

So this should create my window and a pop down button with different options, i woul like to know if it is possible how to make it pop out again with different option


i think you like need to put in...

self.steakVar = IntVar()
self.mb.menu.add_command(label="Blah Blah Blah", command=self.pop up another window)

below each option
but obviously change the name of the thing

How would i implement the below code into my def function??

self.steakVar = IntVar()
self.mb.menu.add_command(label="Blah Blah Blah", command=self.pop up another window)

yeah i think you do. put it in the same column as the other code.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.