diff --git a/Ctrl_Alt_Elite.py b/Ctrl_Alt_Elite.py new file mode 100644 index 0000000..c07ad3c --- /dev/null +++ b/Ctrl_Alt_Elite.py @@ -0,0 +1,116 @@ +import tkinter as tk +import mysql.connector +window = tk.Tk() +window.title("Contact Tracer") +window.geometry("960x640") +name_var = tk.StringVar() +email_id_var = tk.StringVar() +vaccine_status_var = tk.BooleanVar() +covid_status_var = tk.BooleanVar() +contacts_name_lst = [] +contacts_email_id_lst = [] +i = 0 +def submit(): + sqid=1 + name = name_var.get() + email_id = email_id_var.get() + vaccine_status = vaccine_status_var.get() + covid_status = covid_status_var.get() + connection = mysql.connector.connect(host="192.168.43.78",database='trackerdb',user='Remote',password='Password') + cursor = connection.cursor() + sql = "INSERT INTO Clients (name,email_id,covid_status,vaccine_status) VALUES (%s,%s,%s,%s)" + val = (name,email_id,covid_status,vaccine_status) + cursor.execute(sql, val) + connection.commit() + cursor.close() + connection.close() + display = tk.Tk() + display.title("Add Your Contacts") + def add(): + add_contacts = tk.Tk() + add_contacts.title("Contacts Information") + add_name_var = tk.StringVar() + add_email_id_var = tk.StringVar() + #name + c_name_lb = tk.Label(add_contacts,text = "Name", font=("Times New Roman", 12), bg="white").place(x=60,y=400) + name_entry = tk.Entry(add_contacts,textvariable = add_name_var, font=("Times New Roman", 12), bg="white").place(x=280,y=400) + #email + c_email_id_lb = tk.Label(add_contacts,text = "Email ID ", font=("Times New Roman", 12), bg="white").place(x=60,y=430) + c_email_id_entry = tk.Entry(add_contacts,textvariable = add_email_id_var, font=("Times New Roman", 12), bg="white").place(x=280,y=430) + def add_function(i): + connection = mysql.connector.connect(host="192.168.43.78",database='trackerdb',user='Remote',password='Password') + cursor = connection.cursor() + sql1 = "select email_id from Clients" + cursor.execute(sql1) + database=cursor.fetchall() + connection.commit() + cursor.close() + connection.close() + for email in database: + if add_email_id_var.get() == email: + #printing name in table + e_name = tk.Entry(display, width=20, fg='blue',font=('Arial',16,'bold')) + e_name.grid(row = i, column=0) + e_name.insert(tk.END,add_name_var.get()) + #printing email in tabel + e_email = tk.Entry(display, width=20, fg='blue',font=('Arial',16,'bold')) + e_email.grid(row=i, column=1) + e_email.insert(tk.END,add_email_id_var.get()) + #printing covid status + e_cs = tk.Entry(display, width=20, fg='blue',font=('Arial',16,'bold')) + e_cs.grid(row=i, column=2) + e_cs.insert(tk.END,covid_status) + #printing vaccine status + e_vs = tk.Entry(display, width=20, fg='blue',font=('Arial',16,'bold')) + e_vs.grid(row=i, column=3) + e_vs.insert(tk.END,vaccine_status) + i += 1 + c_submit = tk.Button(text = "Add",command = add_function(i)).place(x = 100,y = 500) #button in third window + add_contacts.destroy() + def update_function(): + update = tk.Tk() + update.title("Update My Status") + # email + email_id_lb = tk.Label(update, text="Email ID ", font=("Times New Roman", 12), bg="white").place(x=60, y=430) + email_id_entry = tk.Entry(update, textvariable=email_id_var, font=("Times New Roman", 12), bg="white").place(x=280,y=430) + # covid status + covid_lb = tk.Label(update, text="Are you infected with Covid-19 ?", font=("Times New Roman", 12),bg="white").place(x=60, y=460) + covid_r1 = tk.Radiobutton(update, text="Yes", variable=covid_status_var, value=1).place(x=280, y=460) + covid_r2 = tk.Radiobutton(update, text="No", variable=covid_status_var, value=0).place(x=330, y=460) + # vaccine status + vaccine_lb = tk.Label(window, text="Did you get vaccine ?", font=("Times New Roman", 12), bg="white").place(x=60, + y=490) + vaccine_r1 = tk.Radiobutton(update, text="Yes", variable=vaccine_status_var, value=1).place(x=280, y=490) + vaccine_r2 = tk.Radiobutton(update, text="No", variable=vaccine_status_var, value=0).place(x=330, y=490) + def update_button(): + connection = mysql.connector.connect(host="192.168.43.78",database='trackerdb',user='Remote',password='Password') + cursor = connection.cursor() + sql3= "Update Clients set covid_status=%s,vaccine_status=%s where email_id=%s" + cursor.execute(sql3,(covid_status_var.get(),vaccine_status_var.get(),email_id_var.get())) + connection.commit() + cursor.close() + connection.close() + submit_bt = tk.Button(update, text="Update", fg="white", bg="black", command=update_button).place(x=100, y=600) + update.destroy() + add_contacts_bt = tk.Button(display, text="Add", command=add).pack() # button in second window + update_status = tk.Button(display,text = "Update my status",command = update_function ).pack() # button in second window + window.destroy() +#name +name_lb = tk.Label(window,text = "Name", font=("Times New Roman", 12), bg="white").place(x=60,y=400) +name_entry = tk.Entry(window,textvariable = name_var, font=("Times New Roman", 12), bg="white").place(x=280,y=400) +#email +email_id_lb = tk.Label(window,text = "Email ID ", font=("Times New Roman", 12), bg="white").place(x=60,y=430) +email_id_entry = tk.Entry(window,textvariable = email_id_var, font=("Times New Roman", 12), bg="white").place(x=280,y=430) +#covid status +covid_lb = tk.Label(window,text = "Are you infected with Covid-19 ?", font=("Times New Roman", 12), bg="white").place(x=60,y=460) +covid_r1 = tk.Radiobutton(window, text="Yes", variable=covid_status_var, value= 1).place(x=280,y=460) +covid_r2 = tk.Radiobutton(window, text="No", variable=covid_status_var, value= 0).place(x=330,y=460) +#vaccine status +vaccine_lb = tk.Label(window,text = "Did you get vaccine ?", font=("Times New Roman", 12), bg="white").place(x=60,y=490) +vaccine_r1 = tk.Radiobutton(window, text="Yes", variable=vaccine_status_var, value= 1).place(x=280,y=490) +vaccine_r2 = tk.Radiobutton(window, text="No", variable=vaccine_status_var, value= 0).place(x=330,y=490) +#submit button +submit_bt = tk.Button(window,text = "SUBMIT",fg="white", bg="black",command = submit).place(x = 100,y = 600) +window.mainloop() +print(contacts_name_lst) +print(contacts_email_id_lst) diff --git a/README.md b/README.md index a469fa4..9172727 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,71 @@ -# Hackathon-Python -Repository for python submissions for Zense Hackathon 2021 -You have to make your python submission pull request to this repository. + From team #<<<<>>>>># + Saketh Gajawada and Darshak Jivrajani + +A small poem for u(Zense) + +This hackathon held by ZENSE. +At first, made us tense. + +But........ + +With ur kindness u got our attention; +Every time v asked something u planted a seed Of motivation. + +Thankyou Zense for being there; +Thankyou for showing concern and care. + +Thankyou for keeping us in the track; +Thankyou for helping with what we lack. + +For being what u r; +U have always been our college superstars. + +It may look like We r bluffing; +But its actually a thankful opening. + + + COVID-19 CONTACT TRACER + +IDEA OF THE PROJECT : + Our main idea is to stop the spreading of Covid-19.We made a contact tracer application which warns us through an email when any previously contacted person gets infected. This may help us to take precautions or by being self quarantine may reduce the spreading of corona virus. + +IMPLEMENTATION: +We tried to implement it using Tkinter and database connectivity.We used Tkinter to develop the UI for the application. For maintaining the data of all the users we needed a database and also the database which can be used by all the people all over the world we needed a database server, so for that we used MySql. We had also planned to make the mailing system but could not implement it in the code. At present the takes input from the user and adds the user to the Database and we can add our contacts and update our current status. + +DIFFICULTIES FACED: +The issues which came up during implementation were : + Making the Mysql database remotely accessable was a issue as we were unaware of the steps to do it. We tried to solve this issue by looking throught stackoverflow pages and trying to implement and undestand the solution given there. + Python implementation of connecting the database was also a tough part.We used youtube videos and some tutorials to overcome it. + It was really difficult to manage the control flow of gui,for example checking the order of windows,We actually have 4 windows to display.To overcome this all I did is to check with >>>>>>>>>patience<<<<<<<. + Labelling variables was also one of the biggest task,dealt it with naming variables as clear as possible however long it may be. + +WHAT WE LEARNED: +We learnt how to give database connectivity to a python file and also how to give remote access and how to use that access of a database using a python file. Also we learnt to make a complicated GUI using Tkinter and explored the Tkinter module as much as possible. We could have implemented more but than could not have learned more details. We also wanted to learn how to make a automatic mailing system to send notifications, but could not do it but will surely research and learn about it. We also wanted to make the app with location optimized and learn how to get location access and use it. We both basically found our interests and both had similar. + + + + + + + + + + + + + + + + + + + -Message from Vikas Yadav: Founder of Zense -Hi folks, -Very happy to see this hackathon happening again. While on campus I loved being part of events like these. A lot of my interests developed as side effects of these events. With that in mind and to encourage the spirit of innovation - I would like to announce a bonus prize of Rs 5000 from my side for the idea which I find the best. In case it's difficult to decide a single winner - please don't mind if I split the prize into two. -Parameters I am going to judge you on: -- Feasibility of the idea -- Completeness of the implementation -- Effort you put in -- Impact of the idea -Some potential ideas you can think of: -- Automate a mundane task which you might have to everyday using python -- Explore the python ecosystem to find some amazing libraries - use it to solve a real-world problem around you -- Or just make something cool -And it's not just about the award, if you are interested after the hackathon to pursue your idea further I would be happy to mentor. -Regards, -Vikas