05 Nov PMCA Saturday 18:30 Python Homework 20.10.31.
Posted at 19:19h in Uncategorized 0 Comments
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()
Sorry, the comment form is closed at this time.