Page 58 - Phyton_GUIprogrammingwithTkinter
P. 58
P a ge | 49
root = Tk ()
root.title("Registration Form")
root.geometry("470x470")
subtitle= Label (root, text="Please enter your details to
login",font=("Helvetica",12),foreground='black',
bg="#009e00”, width=550, height=1). pack ()
canvas1 = Canvas (root, width = 470, height = 470)
Canvas1 = Canvas(root)
canvas1.pack()
lblName=Label(root,text="Name*",font=("Helvetica",11))
lblName.place(x=20, y=60)
name=Entry(root,font=("Helvetica",11))
name.place(x=120,y=52, width=230, height=25)
lblAge=Label(root,text="Age*",font=("Helvetica",11))
lblAge.place(x=20, y=110)
age=Entry(root,font=("Helvetica",11))
age.place(x=120,y=102, width=230, height=25)
lblEmail=Label(root,text="Email*",font=("Helvetica",11))
lblEmail.place(x=20, y=160)
email=Entry(root,font=("Helvetica",11))
email.place(x=120,y=152, width=230, height=25)
lblGen=Label(root,text="Gender*",font=("Helvetica",11))
lblGen.place(x=20, y=210)
gender=IntVar ()
gender.set (1)
r1=Radiobutton (root, text="Male",font=("Helvetica",11)
,variable=gender,value=1)
r2=Radiobutton (root, text="Female",font=("Helvetica",11),
variable=gender,value=2)
r1. place (x=130, y=210)
r2. place (x=240, y=210)
lblCity=Label(root,text="City*",font=("Helvetica",11))
lblCity.place(x=20, y=260)
var1 = StringVar ()
var1.set ("Alor Gajah")
data= ("Alor Gajah", "Kuantan", "Kuala Terengganu",
"Kuching","Seremban")
city=Combobox (root, values=data,width=40)
city.place(x=120, y=260)
lblCity=Label(root,text="State*",font=("Helvetica",11))
lblCity.place(x=20, y=310)
var2 = StringVar ()
var2.set("Melaka")
data= ("Melaka", "Negeri Sembilan", "Pahang",
"Sarawak","Terengganu")
state=Combobox (root, values=data,width=40)
state.place(x=120, y=310)