How to create a Simple registration form.


In this project we are going to design a simple registration form with the help/combine of many different types of widgets. This form is designed with few default value, which will be cleared off automatically once you click on the entry widget to input data.

Below code will design the registration form as shown in above screen shot.


#program

try:
from Tkinter import *
except:
from tkinter import *

def on_click(event):
event.widget.delete(0, END)
def check_valid_num():
a = int(num_e.get())
print(a)
def collect_data():
print('date :', dd.get())
print('month:', mm.get())
print('year :', yy.get())

mw = Tk()

mw.geometry("600x400+50+50")
mw.title("AETies : Automation Expert Technologies")

hdng = Label(mw, text='A simple format of REGISTRATION FORM ', fg='blue', pady=10).pack()

# ********** designing name section **********
name_l = Label(mw, text='Name :\t', ).place(x=10, y=50)
name_fn = Entry(mw, width=22)
name_fn.place(x=100, y=50)
name_fn.insert(0,'first name')
name_fn.bind("<Button-1>", on_click)
name_ln = Entry(mw, width=22)
name_ln.place(x=350, y=50)
name_ln.insert(0,'last name')
name_ln.bind("<Button-1>", on_click)

# ********** designing email section **********
email_l = Label(mw, text='Email :\t', ).place(x=10, y=90)
email_e = Entry(mw, width=50)
email_e.place(x=100, y=90)
email_e.insert(0,'example@example.com')
email_e.bind("<Button-1>", on_click)

# ********** designing date of birth section **********
dob_l = Label(mw, text='D.O.B(dd/mm/yyyy) :\t', ).place(x=10, y=130)
dd = Spinbox(mw, from_=1, to=31, width=3).place(x=180, y=130)
mm = Spinbox(mw, from_=1, to=12, width=3).place(x=240, y=130)
yy = Spinbox(mw, from_=1965, to=2020, width=5).place(x=300, y=130)

# ********** designing mobile number entry section **********
num_l = Label(mw, text='Contact No. :\t', ).place(x=10, y=170)
num_e = Entry(mw, width=50)
num_e.place(x=100, y=170)
num_e.insert(0,'0123456789')
num_e.bind("<Button-1>", on_click)

# ********** designing create and confirm password entry section **********
pass_l = Label(mw, text='Password:\t', ).place(x=10, y=210)
pass_p = Entry(mw, width=50)
pass_p.place(x=100, y=210)
pass_l = Label(mw, text='Confirm:\t', ).place(x=10, y=250)
pass_c = Entry(mw, width=50)
pass_c.place(x=100, y=250)


btn = Button(mw, text=' register ', fg='blue',).place(x=280, y=300)

mainloop()


to add ore to this, let us collect all the entered values in the form by user , click on the link below

How to collect all entered values in registration form.




Comments

My photo
Techno Xpresss
Bangalore, Karnataka, India