05 Nov PMCA Saturday 18:30 Python Homework 20.10.31.
Add two menu buttons in the calculator application we built in the last class. Make sure when we click the first menu button it should print “Menu 1 clicked” and when you click the second menu button it should print “Menu 2 clicked”
Below image shows the calculator with the menu items on top of it.
# create a simple tkinter winder which shows hwo menus are added in tkinter from tkinter import * tk = Tk() def hello(): print('Menu item pressed') menubar = Menu(tk) menubar.add_command(label = 'Menu Item1', command = hello) tk.config(menu = menubar) tk.mainloop()