All Page
All Page
def common_obj():
window = Tk()
app = login_page(window)
window.mainloop()
class login_page:
def __init__(self,root):
self.root = root
self.root.title("Neel Games Store")
self.root.geometry("1550x840+0+0")
# ========variables=========
self.var_username = StringVar()
self.var_password = StringVar()
frame = Frame(self.root,bg="white")
frame.place(x=600,y=30,width=340,height=490)
get_str_lbl = Label(frame,text="Get
Started",font=("cursive",20,"bold"),fg="black",bg="white")
get_str_lbl.place(x=550,y=60)
#==========USERNAME==================
username =
Label(frame,text="USERNAME:",font=("cursive",10,"bold"),fg="black",bg="white")
username.place(x=50,y=120)
self.txtuser =
Entry(frame,textvariable=self.var_username,font=("cursive",10,"bold"),bd=4)
self.txtuser.place(x=20,y=145,width=290)
#==========PASSWORD==================
password =
Label(frame,text="PASSWORD:",font=("cursive",10,"bold"),fg="black",bg="white")
password.place(x=50,y=200)
self.password =
Entry(frame,textvariable=self.var_password,font=("cursive",10,"bold"),bd=4)
self.password.place(x=20,y=230,width=290)
#=========USERNAME_ICON============
username_icon = Image.open(r"C:\Users\NEEL PATEL\OneDrive\Desktop\project
images\username_icon.jpg")
username_icon = username_icon.resize((50,50),Image.Resampling.LANCZOS)
self.photoimage2 = ImageTk.PhotoImage(username_icon)
lbl_img = Label(image=self.photoimage2,bg="black",borderwidth=0)
lbl_img.place(x=625,y=145,width=25,height=25)
get_str_lbl = Label(frame,text="Get
Started",font=("cursive",20,"bold"),fg="black",bg="white")
get_str_lbl.place(x=550,y=60)
#=========PASSWORD_ICON============
password_icon = Image.open(r"C:\Users\NEEL PATEL\OneDrive\Desktop\project
images\password_icon.jpg")
password_icon = password_icon.resize((50,50),Image.Resampling.LANCZOS)
self.photoimage3 = ImageTk.PhotoImage(password_icon)
lbl_img = Label(image=self.photoimage3,bg="black",borderwidth=0)
lbl_img.place(x=625,y=230,width=25,height=25)
get_str_lbl = Label(frame,text="Get
Started",font=("cursive",20,"bold"),fg="black",bg="white")
get_str_lbl.place(x=550,y=60)
#=========LOGIN_BUTTON============
#=========REGISTRATION_BUTTON============
#=========FORGOT_PASSWORD_BUTTON============
def register_window(self):
self.new_window = Toplevel(self.root)
self.app = register(self.new_window)
def login(self):
if self.txtuser.get() == "" or self.password.get() == "":
messagebox.showerror("Error","All fields are required")
elif self.txtuser.get() == "neel" and self.password.get() == "1234":
messagebox.showinfo("Success","Welcome to Video Game Store")
else:
conn =
mysql.connector.connect(host="localhost",user="root",password="Neel_123",database="
mydata")
curr = conn.cursor()
curr.execute("select * from register where email = %s and password =
%s", (
self.var_username.get(),
self.var_password.get()
))
row = curr.fetchone()
if row == None:
messagebox.showerror("Error","Invalid username or password")
else:
messagebox.showinfo("Success","Login Success")
self.new_window = Toplevel(self.root)
self.app = videogame(self.new_window)
conn.commit()
conn.close()
class register:
def __init__(self,root):
self.root = root
self.root.title("Registration")
self.root.geometry("1600x900+0+0")
#============Variables=============
self.var_fname = StringVar()
self.var_lname = StringVar()
self.var_contact = StringVar()
self.var_email = StringVar()
self.var_SecurityQ = StringVar()
self.var_SecurityA = StringVar()
self.var_create_pass = StringVar()
self.var_confirm_pass = StringVar()
#==============background==============
self.bg = ImageTk.PhotoImage(file=r"C:\Users\NEEL PATEL\OneDrive\
Desktop\project images\login_background.jpg")
bg_lbl = Label(self.root,image=self.bg)
bg_lbl.place(x=0,y=0,relwidth=1,relheight=1)
#==============main_frame==============
frame = Frame(self.root,bg="white")
frame.place(x=200,y=50,height=700,width=1200)
#============row1
fname = Label(frame,text="First Name:
",font=("cursive",20),bg="white")
fname.place(x=30,y=150)
fname_enty =
ttk.Entry(frame,textvariable=self.var_fname,font=("arial",20,"bold"))
fname_enty.place(x=250,y=150)
lname_enty =
ttk.Entry(frame,textvariable=self.var_lname,font=("arial",20,"bold"))
lname_enty.place(x=750,y=150)
#============row2
contact_num = Label(frame,text="Contact Number:
",font=("cursive",20),bg="white")
contact_num.place(x=30,y=250)
contact_num_enty =
ttk.Entry(frame,textvariable=self.var_contact,font=("arial",20,"bold"))
contact_num_enty.place(x=250,y=250)
email_enty =
ttk.Entry(frame,textvariable=self.var_email,font=("arial",20,"bold"))
email_enty.place(x=750,y=250)
#============row3
create_pass = Label(frame,text="Create Password:
",font=("cursive",20),bg="white")
create_pass.place(x=30,y=350)
create_pass_enty =
ttk.Entry(frame,textvariable=self.var_create_pass,font=("arial",20,"bold"))
create_pass_enty.place(x=250,y=350)
confirm_pass_enty =
ttk.Entry(frame,textvariable=self.var_confirm_pass,font=("arial",20,"bold"))
confirm_pass_enty.place(x=850,y=350)
#============row4
security_quetion = Label(frame,text="Security Quetion:
",font=("cursive",20),bg="white")
security_quetion.place(x=30,y=450)
self.combo_security_Q =
ttk.Combobox(frame,textvariable=self.var_SecurityQ,font=("cursive",20),state="reado
nly")
self.combo_security_Q["values"]=("Select","Your Birth Place","Your
Pet Name")
self.combo_security_Q.place(x=250,y=450)
self.combo_security_Q.current(0)
security_ans_enty =
ttk.Entry(frame,textvariable=self.var_SecurityA,font=("arial",20,"bold"))
security_ans_enty.place(x=850,y=450)
#===========checkbox button===========
self.var_check = IntVar()
check_btn = Checkbutton(frame,variable=self.var_check,text="I agree
the terms and condiditons",font=("Arial
Black",15,"bold"),bg="white",activebackground="white",onvalue=1,offvalue=0)
check_btn.place(x=50,y=540)
#===========buttons==================
img = Image.open(r"C:\Users\NEEL PATEL\OneDrive\Desktop\project
images\register_button.jpg")
img=img.resize((250,100),Image.Resampling.LANCZOS)
self.photoimage = ImageTk.PhotoImage(img)
b1 =
Button(frame,command=self.register_data,image=self.photoimage,borderwidth=0,cursor=
"hand2",font=("cursive",20,"bold"),bg="white")
b1.place(x=100,y=590,width=240)
def register_data(self):
if self.var_fname.get() == "" or self.var_email.get() == "" or
self.var_SecurityQ.get() == "Select":
messagebox.showerror("Error","All fields are requried")
elif self.var_create_pass.get() != self.var_confirm_pass.get():
messagebox.showerror("Error","Password does not match")
elif self.var_check.get() == 0:
messagebox.showerror("Error","Please agree the terms and
conditions")
else:
conn =
mysql.connector.connect(host="localhost",user="root",password="Neel_123",database="
mydata")
curr = conn.cursor()
query = ("select * from register where email = %s")
value = (self.var_email.get(),)
curr.execute(query,value)
row = curr.fetchone()
if row!=None:
messagebox.showerror("Error","Email already in
use")
else:
curr.execute("insert into register values(%s,%s,%s,
%s,%s,%s,%s)",(
self.var_fname.get(),
self.var_lname.get(),
self.var_contact.get(),
self.var_email.get(),
self.var_SecurityQ.get(),
self.var_SecurityA.get(),
self.var_create_pass.get()
))
conn.commit()
conn.close()
messagebox.showinfo("Success","Register
Successfully")
class videogame:
def __init__(self,root):
self.root = root
self.root.title("Neel Games Store")
self.root.geometry("1550x840+0+0")
#===========================img1===================================================
======
img1=Image.open(r"C:\Users\NEEL PATEL\OneDrive\Desktop\project images\
gaming banner.jpg")
# img1=img1.resize((1550,140),Image.ANTIALIAS)
img1=img1.resize((1500,540),Image.Resampling.LANCZOS)
self.photoimg1=ImageTk.PhotoImage(img1)
lblimg = Label(self.root,image=self.photoimg1,bd=4,relief=RIDGE)
lblimg.place(x=0,y=0,width=1550,height=140)
#===========================img2===================================================
======
img2=Image.open(r"C:\Users\NEEL PATEL\OneDrive\Desktop\project images\
logo.jpg")
# img1=img1.resize((1550,140),Image.ANTIALIAS)
img2=img2.resize((150,140),Image.Resampling.LANCZOS)
self.photoimg2=ImageTk.PhotoImage(img2)
lblimg2 = Label(self.root,image=self.photoimg2,bd=4,relief=RIDGE)
lblimg2.place(x=0,y=0,width=140,height=140)
#===========================title==================================================
=======
lbl_title = Label(self.root,text="Online Video Game Store",
font=("cursive",40,"bold"),bg="black",fg="gold",relief=RIDGE)
lbl_title.place(x=0,y=140,width=1550,height=50)
#===========================main
frame=========================================================
main_frame = Frame(self.root,bd=4,bg="black",relief=RIDGE)
main_frame.place(x=0,y=190,width=1550,height=650)
#===========================menu===================================================
======
lbl_menu = Label(main_frame,text="MENU",
font=("cursive",20,"bold"),bg="black",fg="gold",relief=RIDGE)
lbl_menu.place(x=0,y=0,width=1550,height=50)
#===========================btn
frame=========================================================
btn_frame = Frame(bg="white",relief=RIDGE)
btn_frame.place(x=4,y=250,width=400,height=300)
reg_btn=Button(btn_frame,text="Sign Up/Log
in",font=("cursive",20,"bold"),width=35,bg="black",bd=0,fg="gold",cursor="hand2")
reg_btn.grid(row=0,column=0)
brw_btn=Button(btn_frame,text="Browse",
font=("cursive",20,"bold"),width=35,bg="black",bd=0,fg="gold",cursor="hand2")
brw_btn.grid(row=1,column=0)
lbry_btn=Button(btn_frame,text="Library",
font=("cursive",20,"bold"),width=35,bg="black",bd=0,fg="gold",cursor="hand2")
lbry_btn.grid(row=2,column=0)
feedback_btn=Button(btn_frame,text="FeedBack",
font=("cursive",20,"bold"),width=35,bg="black",bd=0,fg="gold",cursor="hand2")
feedback_btn.grid(row=4,column=0)
report_btn=Button(btn_frame,text="Report",
font=("cursive",20,"bold"),width=35,bg="black",bd=0,fg="gold",cursor="hand2")
report_btn.grid(row=5,column=0)
#===========================right_side
img=========================================================
img3=Image.open(r"C:\Users\NEEL PATEL\OneDrive\Desktop\project images\
home_right_img.jpg")
# img1=img1.resize((1550,140),Image.ANTIALIAS)
img3=img3.resize((1010,570),Image.Resampling.LANCZOS)
self.photoimg3=ImageTk.PhotoImage(img3)
lblimg3 = Label(self.root,image=self.photoimg3,bd=4,relief=RIDGE)
lblimg3.place(x=500,y=250,width=1020,height=580)
if __name__ == "__main__":
common_obj()