MenuBars in py
- Get link
- X
- Other Apps
MenuBars In Python
Example:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
app = Tk() | |
menubar = Menu(app) | |
filemenu = Menu(menubar, tearoff=0)#tearoff shows a line like ------ in starting | |
menubar.add_cascade(label="file", menu=filemenu) | |
def save(): | |
pass | |
def openf(): | |
pass | |
filemenu.add_command(label="save", command=save) | |
filemenu.add_command(label="open", command=openf) | |
filemenu.add_separator() # speerator is line to seperate commands | |
filemenu.add_command(label="exit", command=lambda: | |
app.quit() | |
) | |
app.config(menu=menubar) | |
app.mainloop() |
- Get link
- X
- Other Apps
Comments
Post a Comment
hello