Skip to content

Commit 257a57d

Browse files
authoredJul 1, 2020
Create tkinter-7.py
1 parent 0678f2f commit 257a57d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
 

‎tkinter-7.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import tkinter as tk
2+
from tkinter import *
3+
root = tk.Tk()
4+
root.title('Form')
5+
root.geometry("250x160")
6+
7+
#variable
8+
var = IntVar()
9+
#label
10+
l1 = Label(root,text="Radio Buttons",font=("verdana",10,"bold"))
11+
l1.grid(sticky="w",padx=60)
12+
13+
#radiobuttons
14+
r1 = Radiobutton(root,text="R1", value=1,variable=var)
15+
r1.grid(sticky="w",row=1,pady=10)
16+
17+
r2 = Radiobutton(root,text="R2", value=2,variable=var,relief=RIDGE)
18+
r2.grid(sticky="w",row=1,padx=60,pady=10)
19+
20+
r3 = Radiobutton(root,text="R3", value=3,variable=var,relief=SUNKEN)
21+
r3.grid(sticky="w",row=1,padx=120,pady=10)
22+
23+
r4 = Radiobutton(root,text="R4", value=4,variable=var,relief=RIDGE,bg="red",fg="white")
24+
r4.grid(sticky="w",row=1,padx=180,pady=10)
25+
26+
#label
27+
l2 = Label(root,text="Check Buttons",font=("verdana",10,"bold"))
28+
l2.grid(sticky="w",padx=60)
29+
30+
#checkbuttons
31+
c1 = Checkbutton(root,text="C1")
32+
c1.grid(row=3,sticky="w",pady=10)
33+
34+
c2 = Checkbutton(root,text="C2",relief=SUNKEN)
35+
c2.grid(row=3,sticky="w", padx=60,pady=10)
36+
37+
c3 = Checkbutton(root,text="C3",relief=RIDGE)
38+
c3.grid(row=3,sticky="w", padx=120,pady=10)
39+
40+
c4 = Checkbutton(root,text="C4",relief=SUNKEN,bg="cyan",fg="white")
41+
c4.grid(row=3,sticky="w", padx=180,pady=10)
42+
43+
root.mainloop()
44+
45+

0 commit comments

Comments
 (0)
Please sign in to comment.