-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpadding.py
More file actions
39 lines (33 loc) · 1.1 KB
/
padding.py
File metadata and controls
39 lines (33 loc) · 1.1 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
39
import tkinter as tk
from tkinter import ttk
win=tk.Tk()
win.title('LOOP')
labels = ['What is your name :','What is your age :','What is your gender :','Country :','State :','City :' ]
for i in range(len(labels)):
cur_label='label'+str(i)
cur_label=ttk.Label(win,text=labels[i])
cur_label.grid(row=i,column=0,sticky=tk.W,padx=2,pady=2)
user_info ={
'name':tk.StringVar(),
'age':tk.StringVar(),
'gender':tk.StringVar(),
'country':tk.StringVar(),
'state':tk.StringVar(),
'city':tk.StringVar()
}
counter=0
for i in user_info:
cur_entrybox = 'entry' + i
cur_entrybox=ttk.Entry(win,width=16,textvariable=user_info[i])
cur_entrybox.grid(row=counter,column=1,padx=2,pady=2)
counter+=1
def submit():
print(user_info['name'].get())
print(user_info['age'].get())
print(user_info['gender'].get())
print(user_info['country'].get())
print(user_info['state'].get())
print(user_info['city'].get())
submit_button=ttk.Button(win,text="Submit",command=submit)
submit_button.grid(row=6,columnspan=2)
win.mainloop()