-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtkinterlab1.py
More file actions
38 lines (38 loc) · 1.26 KB
/
tkinterlab1.py
File metadata and controls
38 lines (38 loc) · 1.26 KB
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
from tkinter import *
top = Tk()
def f1():
f1="My country is " + radio.get()+". My state is " +radio1.get()+". My district is "+radio2.get()+"."
label.config(text=f1)
radio= StringVar()
radio.set("India")
radio1= StringVar()
radio1.set("Tamilnadu")
radio2= StringVar()
radio2.set("Dindigul")
label1=Label(text="Enter your country")
label1.pack()
R1=Radiobutton(top,text="India",variable=radio,value="India",command=f1)
R1.pack()
R2=Radiobutton(top,text="USA",variable=radio,value="USA",command=f1)
R2.pack()
R3=Radiobutton(top,text="Others",variable=radio,value="Others",command=f1)
R3.pack()
label2=Label(text="Enter your state")
label2.pack()
Ra1=Radiobutton(top,text="Tamilnadu",variable=radio1,value="Tamilnadu",command=f1)
Ra1.pack()
Ra2=Radiobutton(top,text="Kerala",variable=radio1,value="Kerala",command=f1)
Ra2.pack()
Ra3=Radiobutton(top,text="Others",variable=radio1,value="Others",command=f1)
Ra3.pack()
label3=Label(text="Enter your district")
label3.pack()
Rad1=Radiobutton(top,text="Dindigul",variable=radio2,value="Dindigul",command=f1)
Rad1.pack()
Rad2=Radiobutton(top,text="Salem",variable=radio2,value="Salem",command=f1)
Rad2.pack()
Rad3=Radiobutton(top,text="Others",variable=radio2,value="Others",command=f1)
Rad3.pack()
label=Label(top)
label.pack()
top.mainloop()