From 5d698d732daa07fc360d121436067c21e708aaa8 Mon Sep 17 00:00:00 2001 From: avinash kumar <44425342+avinash0786@users.noreply.github.com> Date: Fri, 27 Mar 2020 19:42:39 +0530 Subject: [PATCH] IMPORTANT mydatabase.db is containing sqlite database of mobile phones, TO RUN IN PYTHON DOWNLOAD ALL UPLOADED FILES AND IMPORT NECESSARY LIBRARY --- DETAILS2.py | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++ details.py | 116 +++++++++++++++++++++++++++++++++++++ mydatabase.db | Bin 0 -> 8192 bytes 3 files changed, 273 insertions(+) create mode 100644 DETAILS2.py create mode 100644 details.py create mode 100644 mydatabase.db diff --git a/DETAILS2.py b/DETAILS2.py new file mode 100644 index 0000000..9ae176e --- /dev/null +++ b/DETAILS2.py @@ -0,0 +1,157 @@ +from tkinter import * +import sqlite3 +import buy +idn=0 +f=0 +a=0 +p=0 +s=0 +def runcompare(x): + global idn + idn=idn+x + con=sqlite3.connect('mydatabase.db') + cur=con.cursor() + top = Tk() + top.geometry("300x450") + top.resizable(False,False) + top.title("Product compare") + head = Label(top, text = " PRODUCT DETAILS ", fg = "red", bg = "white", relief=RIDGE,font = "Verdana 15 bold").pack(side=TOP) + #//////////////////////////////////////////////// + divmain = Frame(top, highlightbackground="black", bg="white", highlightthickness=2, width=285, height=400, bd= 0) + divmain.place(x = 10,y = 40) + + + com=Label(divmain, text="COMPANY: ",font = "Verdana 10") + com.place(x = 15,y = 10) + com=Entry(divmain,width=20, bd=1,relief=GROOVE,bg="white") ######company + com.place(x = 150,y = 10) + + mod=Label(divmain, text="MODEL: ",font = "Verdana 10") + mod.place(x = 15,y = 40) + mod=Entry(divmain,width=20, bd=1,relief=GROOVE,bg="white") ######company + mod.place(x = 150,y = 40) + + ram=Label(divmain, text="RAM: ",font = "Verdana 10") + ram.place(x = 15,y = 70) + ram=Entry(divmain,width=20, bd=1,relief=GROOVE,bg="white") ######company + ram.place(x = 150,y = 70) + + stor=Label(divmain, text="STORAGE: ",font = "Verdana 10") + stor.place(x = 15,y = 100) + stor=Entry(divmain,width=20, bd=1,relief=GROOVE,bg="white") ######company + stor.place(x = 150,y = 100) + + fcam=Label(divmain, text="FRONT CAMERA: ",font = "Verdana 10") + fcam.place(x = 15,y = 130) + fcam=Entry(divmain,width=20, bd=1,relief=GROOVE,bg="white") ######company + fcam.place(x = 150,y = 130) + + rcam=Label(divmain, text="REAR CAMERA: ",font = "Verdana 10") + rcam.place(x = 15,y = 160) + rcam=Entry(divmain,width=20, bd=1,relief=GROOVE,bg="white") ######company + rcam.place(x = 150,y = 160) + + bat=Label(divmain, text="BATTERY: ",font = "Verdana 10") + bat.place(x = 15,y = 190) + bat=Entry(divmain,width=20, bd=1,relief=GROOVE,bg="white") ######company + bat.place(x = 150,y = 190) + + head = Label(divmain, text = "PRICE", fg = "GREEN", bg = "white",font = "Verdana 10 bold").place(x = 120,y = 220) + + flip=Label(divmain, text="FLIPKART : ",font = "Verdana 10") + flip.place(x = 15,y = 260) + flip=Entry(divmain,width=10, bd=1,relief=GROOVE,bg="white") ######company + flip.place(x = 120,y = 260) + + amz=Label(divmain, text="AMAZON: ",font = "Verdana 10") + amz.place(x = 15,y = 290) + amz=Entry(divmain,width=10, bd=1,relief=GROOVE,bg="white") ######company + amz.place(x = 120,y = 290) + + pay=Label(divmain, text="PAYTM: ",font = "Verdana 10") + pay.place(x = 15,y = 320) + pay=Entry(divmain,width=10, bd=1,relief=GROOVE,bg="white") ######company + pay.place(x = 120,y = 320) + + sanp=Label(divmain, text="SNAPDEAL: ",font = "Verdana 10") + sanp.place(x = 15,y = 350) + sanp=Entry(divmain,width=10, bd=1,relief=GROOVE,bg="white") ######company + sanp.place(x = 120,y = 350) + + + #**************************************************************************** + def fun1(): #flipkart + global idn + global f + buy.buyproduct(idn,f) + def fun2(): #amazon + global idn + global a + buy.buyproduct(idn,a) + def fun3(): #paytm + global idn + global p + buy.buyproduct(idn,p) + def fun4(): #snapdeal + global idn + global s + buy.buyproduct(idn,s) + + buy1 = Button(top, text="BUY", fg="green", font="Verdana 8 bold",command=fun1).place(x=210, y=300) + buy2 = Button(top, text="BUY", fg="green", font="Verdana 8 bold",command=fun2).place(x=210, y=330) + buy3 = Button(top, text="BUY", fg="green", font="Verdana 8 bold",command=fun3).place(x=210, y=360) + buy4 = Button(top, text="BUY", fg="green", font="Verdana 8 bold",command=fun4).place(x=210, y=390) + + #//////////////////////////////////// + + + #**********************QUERY****************************** + query="select * from phones where id={}".format(x) + result=cur.execute(query).fetchone() + print(result) + company=result[0] + MODEL=result[2] + RAM=result[3] + STORAGE=result[4] + FCAM=result[5] + RCAM=result[6] + BAT=result[7] + FLIP=result[8] + AMAZ=result[9] + PAYT=result[10] + SNAP=result[11] + + global f + f = FLIP + global a + a = AMAZ + global p + p =PAYT + global s + s =SNAP + + com.insert(0,company) + com.config(state='disabled') + mod.insert(0,MODEL) + mod.config(state='disabled') + ram.insert(0,RAM) + ram.config(state='disabled') + stor.insert(0,STORAGE) + stor.config(state='disabled') + fcam.insert(0,FCAM) + fcam.config(state='disabled') + rcam.insert(0,RCAM) + rcam.config(state='disabled') + bat.insert(0,BAT) + bat.config(state='disabled') + flip.insert(0,FLIP) + flip.config(state='disabled') + amz.insert(0,AMAZ) + amz.config(state='disabled') + pay.insert(0,PAYT) + pay.config(state='disabled') + sanp.insert(0,SNAP) + sanp.config(state='disabled') + + + top.mainloop() \ No newline at end of file diff --git a/details.py b/details.py new file mode 100644 index 0000000..fce403e --- /dev/null +++ b/details.py @@ -0,0 +1,116 @@ +from tkinter import * +import sqlite3 + +def details_see(): + con = sqlite3.connect('mydatabase.db') + cur = con.cursor() + top = Tk() + index=yaa + top.geometry("300x450") + top.resizable(False, False) + top.title("Product compare") + head = Label(top, text=" PRODUCT DETAILS ", fg="red", bg="white", relief=RIDGE, font="Verdana 15 bold").pack(side=TOP) + divmain2 = Frame(top, highlightbackground="black", bg="white", highlightthickness=2, width=285, height=400, bd=0) + divmain2.place(x=10, y=40) + com=Label(divmain2, text="COMPANY: ",font = "Verdana 10") + com.place(x = 15,y = 10) + com=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + com.place(x = 150,y = 10) + + mod=Label(divmain2, text="MODEL: ",font = "Verdana 10") + mod.place(x = 15,y = 40) + mod=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + mod.place(x = 150,y = 40) + + ram=Label(divmain2, text="RAM: ",font = "Verdana 10") + ram.place(x = 15,y = 70) + ram=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + ram.place(x = 150,y = 70) + + stor=Label(divmain2, text="STORAGE: ",font = "Verdana 10") + stor.place(x = 15,y = 100) + stor=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + stor.place(x = 150,y = 100) + + fcam=Label(divmain2, text="FRONT CAMERA: ",font = "Verdana 10") + fcam.place(x = 15,y = 130) + fcam=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + fcam.place(x = 150,y = 130) + + rcam=Label(divmain2, text="REAR CAMERA: ",font = "Verdana 10") + rcam.place(x = 15,y = 160) + rcam=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + rcam.place(x = 150,y = 160) + + bat=Label(divmain2, text="BATTERY: ",font = "Verdana 10") + bat.place(x = 15,y = 190) + bat=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + bat.place(x = 150,y = 190) + + head = Label(top, text = "PRICE", fg = "GREEN", bg = "white",font = "Verdana 10 bold").place(x = 120,y = 270) + + + + + + flip=Label(divmain2, text="FLIPKART : ",font = "Verdana 10") + flip.place(x = 15,y = 260) + flip=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + flip.place(x = 150,y = 260) + + amz=Label(divmain2, text="AMAZON: ",font = "Verdana 10") + amz.place(x = 15,y = 290) + amz=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + amz.place(x = 150,y = 290) + + pay=Label(divmain2, text="PAYTM: ",font = "Verdana 10") + pay.place(x = 15,y = 320) + pay=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + pay.place(x = 150,y = 320) + + sanp=Label(divmain2, text="SNAPDEAL: ",font = "Verdana 10") + sanp.place(x = 15,y = 350) + sanp=Entry(divmain2,width=20, bd=1,relief=GROOVE,bg="white") ######company + sanp.place(x = 150,y = 350) + + #**********************QUERY****************************** + query="select * from phones where id={}".format(index) + result=cur.execute(query).fetchone() + print(result) + company=result[0] + MODEL=result[2] + RAM=result[3] + STORAGE=result[4] + FCAM=result[5] + RCAM=result[6] + BAT=result[7] + FLIP=result[8] + AMAZ=result[9] + PAYT=result[10] + SNAP=result[11] + + com.insert(0,company) + com.config(state='disabled') + mod.insert(0,MODEL) + mod.config(state='disabled') + ram.insert(0,RAM) + ram.config(state='disabled') + stor.insert(0,STORAGE) + stor.config(state='disabled') + fcam.insert(0,FCAM) + fcam.config(state='disabled') + rcam.insert(0,RCAM) + rcam.config(state='disabled') + bat.insert(0,BAT) + bat.config(state='disabled') + flip.insert(0,FLIP) + flip.config(state='disabled') + amz.insert(0,AMAZ) + amz.config(state='disabled') + pay.insert(0,PAYT) + pay.config(state='disabled') + sanp.insert(0,SNAP) + sanp.config(state='disabled') + top.mainloop() + return 0 + diff --git a/mydatabase.db b/mydatabase.db new file mode 100644 index 0000000000000000000000000000000000000000..3ed8cca0b2a4e29b87aca22dd6b946cd1e929b23 GIT binary patch literal 8192 zcmeI0F>ljA7>4aqXcKw~RTPEDvU-YyR4A%qyST{!!YL*V#EI*;g$xK?TbG2^NfaBQ zG9kps!odGv=#Su6AS8su$jHcdXD4pU086(!C3e0~=l97+-d!<;R>tQzaW?;X1)sW;)4_51ULasfD_;ZH~~(8 z6W|0m0ZxDuxBvq0mc+S2u_(SThGh518})_*FNm%)8;)tXCU%Wl)5N8yS;EWdRB3PM zkI3M-lyc3d?rmuF_e-fp%Qfq!gIjGEx3-&2+V_Y1-cd4bO#Gw>!r_>_@RG*C^F88w zW0G{ne|2_A7<%JVD<2&7M~7q_PS>Z)5}&*o4$ibjGa3W?uWIkr@qMzAn<`?>eo}t-=6BMHG0yc$9asr$HC%_4C z0-OLRzzJ{yoB${A-vnA|R1_BTg@Rm=Bw5~Ux7ypz`i6$%h*(C zQ7uE^bSl+q6>bVtv{YaUy+28zMd1e1lVy3yYB=Ttt3iM1nOLKOkt)d9YxIeU>g0Jv zJ*%gvv9LZ5MvJ+8PRh@~=)LN_CVd5_AHLM;HBGJ8Dqs{Iri!X%uYSAr``%mq^VS@a z;(%aC?if~QyH$Ur(}bD|7e%89V=om9#ngiWAx~vfbe(1F%z|VNG8Q1=RMODO3AHF6 z6{hHX(o-r?t~gGRra2k73Z3C}oJ#<%K*6zLHGrC-PKhz}ioU|!GICV(JgkXk+;?Wq zY5IL^fD(jOE3miJrCMHL+Eb&D5&Q%STg2%kJ|n-`@4{8^xd9C7S5TgE$QNWulJYx^ zop!gHY;uL7q)RZkV0S%IScek?f#ZFB=$Pi#