forked from flatplanet/Intro-To-TKinter-Youtube-Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradio.py
37 lines (27 loc) · 875 Bytes
/
radio.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
from tkinter import *
from PIL import ImageTk,Image
root = Tk()
root.title('Learn To Code at Codemy.com')
root.iconbitmap('c:/gui/codemy.ico')
#r = IntVar()
#r.set("2")
TOPPINGS = [
("Pepperoni", "Pepperoni"),
("Cheese", "Cheese"),
("Mushroom", "Mushroom"),
("Onion", "Onion"),
]
pizza = StringVar()
pizza.set("Pepperoni")
for text, topping in TOPPINGS:
Radiobutton(root, text=text, variable=pizza, value=topping).pack(anchor=W)
def clicked(value):
myLabel = Label(root, text=value)
myLabel.pack()
#Radiobutton(root, text="Option 1", variable=r, value=1, command=lambda: clicked(r.get())).pack()
#Radiobutton(root, text="Option 2", variable=r, value=2, command=lambda: clicked(r.get())).pack()
#myLabel = Label(root, text=pizza.get())
#myLabel.pack()
myButton = Button(root, text="Click Me!", command=lambda: clicked(pizza.get()))
myButton.pack()
mainloop()