TORONTO KIDS COMPUTER CLUB | PMCA Saturday 18:30 Python Homework 20.10.31.
18564
post-template-default,single,single-post,postid-18564,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

PMCA Saturday 18:30 Python Homework 20.10.31.

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.

Sample program:

# 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()
No Comments

Sorry, the comment form is closed at this time.