Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #CREATE A MENUBAR
- from tkinter import *
- #---------------------------------#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- def openFile(): # +#
- print("File has been opened!")# +#
- #-----------------------------# +#
- def saveFile(): # +#
- print("File has been saved!") # +#
- #-----------------------------# +#
- def cut(): # +#
- print("You cut some text!") # +#
- #-----------------------------# +#
- def copy(): #+++++++++++++++++++++++# + _______
- print("You copied some text!")# + + ____
- #-----------------------------# +---------CODEDSKILLS.NET!-----+----__
- def paste(): # + +
- print("You pasted some text!")# + +
- #---------------------------------#----------------+----------+-------------------+----------------------
- #FILE MENU--------------------------------------------#-------++++++++++++ +
- window = Tk() # +----------------- +
- menubar = Menu(window) #-------++++++++++++ +
- window.config(menu=menubar) # +----------------- +
- fileMenu = Menu(menubar,tearoff=0) #-------++++++++++++ +
- menubar.add_cascade(label="File",menu=fileMenu) # +----------------- +
- fileMenu.add_command(label="Open",command=openFile) #-------++++++++++++ +
- fileMenu.add_command(label="Save",command=saveFile) # +----------------- +
- fileMenu.add_separator() #-------++++++++++++ +
- fileMenu.add_command(label="Exit",command=quit) # +----------------- +
- #-----------------------------------------------------#-------+++++++++++++++++++++------------------------
- #EDIT MENU----------------------------------------------------+-------------------+
- editMenu = Menu(menubar ,tearoff=0) # add spacing to make ur code look nicer
- menubar.add_cascade (label="Edit" ,menu=editMenu) #+----------------- +
- editMenu.add_cascade (label="Cut" ,command=cut) #
- editMenu.add_cascade (label="Copy" ,command= copy)# spacing is fine in some spots.
- editMenu.add_cascade (label="Paste" ,command=paste)
- window.mainloop ()
- #------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement