Python‎ > ‎tkinter‎ > ‎

tkinter.OptionMenu


Definition
Return with the optionmenu in the parent widget.

Syntax
__getitem__(self, name)
__init__(self, master, variable, value, *values, **kwargs)

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