source: python/trunk/Demo/tkinter/guido/optionmenu.py

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 441 bytes
Line 
1# option menu sample (Fredrik Lundh, September 1997)
2
3from Tkinter import *
4
5root = Tk()
6
7#
8# standard usage
9
10var1 = StringVar()
11var1.set("One") # default selection
12
13menu1 = OptionMenu(root, var1, "One", "Two", "Three")
14menu1.pack()
15
16#
17# initialize from a sequence
18
19CHOICES = "Aah", "Bee", "Cee", "Dee", "Eff"
20
21var2 = StringVar()
22var2.set(CHOICES[0])
23
24menu2 = apply(OptionMenu, (root, var2) + tuple(CHOICES))
25menu2.pack()
26
27root.mainloop()
Note: See TracBrowser for help on using the repository browser.