-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
87 lines (66 loc) · 2.68 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import customtkinter
import sqlite3
import tkinter
connection = sqlite3.connect('users.db')
cursor = connection.cursor()
command1 = """CREATE TABLE IF NOT EXISTS
USERS(username text, password text)
"""
cursor.execute(command1)
cursor.execute("INSERT INTO USERS VALUES('user1', 'password1')")
cursor.execute("INSERT INTO USERS VALUES('user2', 'password2')")
cursor.execute("INSERT INTO USERS VALUES('user3', 'password3')")
cursor.execute("INSERT INTO USERS VALUES('user4', 'password4')")
cursor.execute("INSERT INTO USERS VALUES('user5', 'password5')")
customtkinter.set_appearance_mode("light")
customtkinter.set_default_color_theme("blue")
app = customtkinter.CTk()
app.title("Turtle Code Youtube Log In System")
app.geometry("960x540")
bottomframe = tkinter.Frame(app)
bottomframe.pack(expand = True)
def button_event():
cursor.execute("SELECT * from USERS")
results = cursor.fetchall()
for result in results:
if user_name.get() == result[0] and password.get() == result[1]:
label.set_text("Correct")
break
else:
label.set_text("Wrong")
user_name = customtkinter.CTkEntry(master=bottomframe,
placeholder_text="Username",
text_font=('Helvetica',28),
width=800,
height=100,
border_width=2,
corner_radius=10)
user_name.pack()
password = customtkinter.CTkEntry(master=bottomframe,
placeholder_text="Password",
text_font=('Helvetica', 28),
width=800,
height=100,
border_width=2,
corner_radius=10)
password.pack()
button = customtkinter.CTkButton(master=bottomframe,
width=500,
height=100,
border_width=0,
corner_radius=8,
text="Log In",
text_font=('Helvetica', 28),
command=button_event)
button.pack()
label = customtkinter.CTkLabel(master=bottomframe,
text="",
text_color="black",
width=200,
height=100,
text_font=('Helvetica', 28),
fg_color=("white"),
corner_radius=8
)
label.pack()
app.mainloop()