forked from flatplanet/Intro-To-TKinter-Youtube-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dropbind.py
50 lines (38 loc) · 1.04 KB
/
dropbind.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from tkinter import *
from tkinter import ttk
root = Tk()
root.title('Codemy.com - Learn To Code!')
root.iconbitmap('c:/gui/codemy.ico')
root.geometry("400x400")
def selected(event):
#myLabel = Label(root, text=clicked.get()).pack()
if clicked.get() == 'Friday':
myLabel = Label(root, text="Yay! It's Friday").pack()
else:
myLabel = Label(root, text=clicked.get()).pack()
def comboclick(event):
#myLabel = Label(root, text=myCombo.get()).pack()
if myCombo.get() == 'Friday':
myLabel = Label(root, text="Yay! It's Friday").pack()
else:
myLabel = Label(root, text=myCombo.get()).pack()
options = [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
]
clicked = StringVar()
clicked.set(options[0])
drop = OptionMenu(root, clicked, *options, command=selected)
drop.pack(pady=20)
myCombo = ttk.Combobox(root, value=options)
myCombo.current(0)
myCombo.bind("<<ComboboxSelected>>", comboclick)
myCombo.pack()
#myButton = Button(root, text="select from list", command=selected)
#myButton.pack()
root.mainloop()