-
Notifications
You must be signed in to change notification settings - Fork 1
/
reviews.py
52 lines (37 loc) · 1.37 KB
/
reviews.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sqlite3
from tkinter import *
from tkinter import ttk
root = Tk()
root.geometry('500x500')
root.title("GIVE REVIEW")
label = Label(root, text="THANK YOU FOR FOR REVIEW", font=("", 20, "bold"), bg="black", fg="white")
label.pack(side=TOP, fill=X)
label = Label(root, text="", font=("", 15, "bold"), bg="black", fg="white")
label.pack(side=BOTTOM, fill=X)
def create():
conn = sqlite3.connect("/home/nidhi/Documents/Tourist_Guide/database.db")
c = conn.cursor()
c.execute(""" CREATE TABLE IF NOT EXISTS reviews(name TEXT ,review TEXT )""")
conn.commit()
conn.close()
create()
label = Label(root, text="Enter Review Here", font=("", 15, "bold"))
label.place(x=30, y=150)
review_entry = StringVar()
review_entry = ttk.Entry(root, textvariable=review_entry)
review_entry.place(x=30, y=200)
label = Label(root, text="NAME", font=("", 15, "bold"))
label.place(x=30, y=40)
name_entry = StringVar()
name_entry = ttk.Entry(root, textvariable=name_entry)
name_entry.place(x=30, y=90)
def savedata():
conn = sqlite3.connect('/home/nidhi/Documents/Tourist_Guide/reviews.db')
c = conn.cursor()
c.execute('INSERT INTO reviews(name , review) VALUES (?,?)', (name_entry.get(), review_entry.get()))
conn.commit()
print('saved')
btn = ttk.Button(root, text="SAVE REVIEW", command=savedata)
btn.place(x=170, y=400)
root.resizable(False, False)
root.mainloop()