-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.py
71 lines (53 loc) · 1.99 KB
/
generator.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import sqlite3
from tkinter import *
from tkinter import messagebox
import random
#list of lines
pickup = list()
#functions(3)
def pickuplines():
index = random.randrange(0,len(data))
lineStr = str(data[index])
for char in ["{","}","(",")",","]:
lineStr=lineStr.replace(char,"")
line.config(text=lineStr)
def addline():
userLine = str(userInput.get())
if userLine=="":
messagebox.showwarning("warning","can't add empty value")
else:
cur.execute('''INSERT INTO Picklines (line) VALUES (?) ''',(userLine,))
messagebox.showinfo("status","Thank you for your Contribution!")
userInput.delete(0,"end")
conn.commit()
cur.close()
#connect database(1)
conn = sqlite3.connect("pick-lines.db")
cur = conn.cursor()
cur.execute('SELECT line FROM Picklines')
data = cur.fetchall()
#make our UI & components(2)
root = Tk()
root.geometry("750x500+560+200")
root.title("Pick Lines")
root.columnconfigure(0, weight=1)
image_icon = PhotoImage(file="icon.png")
root.iconphoto(False, image_icon)
#pick-up line
lineStr = "LMAO! 😂, you fu*king nerd just press the below ⬇ button"
line = Label(root, text=lineStr, font=("monospace", 16), width=80, height=3)
line.grid(pady=(70))
#next line button
nextLine = Button(root, text="get another❤", width=14, font=("consolas"), bg="#2a9d8f", fg="#dee2e6", command=pickuplines)
nextLine.grid(pady=(10))
#user input
userTag = Label(root, text="Have something unique?", font=("monospace", 15))
userTag.grid(pady=(7))
entrybox = StringVar()
userInput = Entry(root, text=entrybox, width=70)
userInput.grid(pady=(5))
share = Button(root, text="add", width=7, font=("consolas"), bg="#2a9d8f", fg="#dee2e6", command=addline)
share.grid(pady=(4))
ai = Label(root, text="Our AI will decide whether your line is good enough to get added, so please be relevantly romantic \n \n Made with ❤ by Senpai_Knock")
ai.grid(pady=(16,0))
root.mainloop()