GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Basic-python-programs/Menu_Submenu_Tkinter.py at main · Sbiswas001/Basic-python-programs

Expand file tree

/

Menu_Submenu_Tkinter.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
49 lines (46 loc) · 1.38 KB
/

Menu_Submenu_Tkinter.py

Copy path

File metadata and controls

49 lines (46 loc) · 1.38 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#Menu & Submenu
from tkinter import *
def func_new():
print("You clicked on new")
def func_open():
print("You clicked on open")
def func_save():
print("You clicked on save")
def func_print():
print("You clicked on print")
def func_undo():
print("You clicked on undo")
def func_redo():
print("You clicked on redo")
def func_cut():
print("You clicked on cut")
def func_copy():
print("You clicked on copy")
def func_paste():
print("You clicked on paste")
root = Tk()
root.title("Menu & Submenu")
root.geometry("400x400")
#Use this to create a non dropdown menu
# menu1 = Menu(root)
# menu1.add_command(label="File", command=file_func)
# menu1.add_command(label="Exit", command=quit)
# root.config(menu=menu1)
main_menu=Menu(root)
m1=Menu(main_menu,tearoff=0)
m1.add_command(label="New",command=func_new)
m1.add_command(label="Open",command=func_open)
m1.add_separator()
m1.add_command(label="Save",command=func_save)
m1.add_command(label="Print",command=func_print)
main_menu.add_cascade(label="File",menu=m1)
root.config(menu=main_menu)
m2=Menu(main_menu,tearoff=1)
m2.add_command(label="Undo",command=func_undo)
m2.add_command(label="Redo",command=func_redo)
m2.add_separator()
m2.add_command(label="Cut",command=func_cut)
m2.add_command(label="Copy",command=func_copy)
m2.add_command(label="Paste",command=func_paste)
main_menu.add_cascade(label="Edit",menu=m2)
root.mainloop()
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.