tkinter.OptionMenu.variable.set


Definition
Set the variable to value.

Syntax
set(self, value)

Examples
The method returns with the creation of OptionMenu.
 from tkinter import*
master=Tk()

file=StringVar(master)
file.set("File")

optionmenu=OptionMenu(master, file,"New File", "Recent files", "Save", "Save as", "Print")
optionmenu.pack(side=LEFT)

edit=StringVar(master)
edit.set("Edit")

optionmenu=OptionMenu(master, edit,"Undu", "Redo", "Cut", "Copy", "Paste")
optionmenu.pack(side=LEFT)

master.mainloop()





Comments