gui menubar in python

Solutions on MaxInterview for gui menubar in python by the best coders in the world

showing results for - "gui menubar in python"
Juan Pablo
03 Sep 2018
1# Create Menubar in Python GUI Application
2import tkinter as tk
3from tkinter import *
4
5win = tk.Tk()
6win.title("Python GUI App")
7
8
9# Exit action
10def _quit():
11    win.quit()
12    win.destroy()
13    exit()
14
15
16# Create Menu Bar
17menuBar = Menu(win)
18win.config(menu=menuBar)
19# File Menu
20fileMenu = Menu(menuBar, tearoff=0)
21fileMenu.add_command(label="New")
22fileMenu.add_separator()
23fileMenu.add_command(label="Exit", command=_quit)
24menuBar.add_cascade(label="File", menu=fileMenu)
25# Help Menu
26helpMenu = Menu(menuBar, tearoff=0)
27helpMenu.add_command(label="About")
28menuBar.add_cascade(label="Help", menu=helpMenu)
29# Calling Main()
30win.mainloop()
31
32# by Prakashraj P
similar questions
queries leading to this page
gui menubar in python