diff options
author | Guido van Rossum <guido@python.org> | 1998-10-20 15:32:39 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-10-20 15:32:39 +0000 |
commit | 0866d025ac869e1b0da02b70155fd92493be79bd (patch) | |
tree | af829bcc7d2df4230b2eadca4c8310c3cf00bac7 /Demo/tkinter | |
parent | eb8c2bbbd0afa0d4420a1483833599adce83acc0 (diff) | |
download | cpython-0866d025ac869e1b0da02b70155fd92493be79bd.tar.gz |
Adding Fredrik Lundh's demo of the option menu.
Diffstat (limited to 'Demo/tkinter')
-rw-r--r-- | Demo/tkinter/guido/optionmenu.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Demo/tkinter/guido/optionmenu.py b/Demo/tkinter/guido/optionmenu.py new file mode 100644 index 0000000000..be9d3ac2a6 --- /dev/null +++ b/Demo/tkinter/guido/optionmenu.py @@ -0,0 +1,27 @@ +# option menu sample (Fredrik Lundh, September 1997) + +from Tkinter import * + +root = Tk() + +# +# standard usage + +var1 = StringVar() +var1.set("One") # default selection + +menu1 = OptionMenu(root, var1, "One", "Two", "Three") +menu1.pack() + +# +# initialize from a sequence + +CHOICES = "Aah", "Bee", "Cee", "Dee", "Eff" + +var2 = StringVar() +var2.set(CHOICES[0]) + +menu2 = apply(OptionMenu, (root, var2) + tuple(CHOICES)) +menu2.pack() + +root.mainloop() |