Skip to content

Commit 8b5e31f

Browse files
committed
How To Create Login Panel- Python SQLite #Tkinter GUI
How To Create Login Panel- Python SQLite #Tkinter GUI
1 parent 001bf5b commit 8b5e31f

File tree

9 files changed

+150
-0
lines changed

9 files changed

+150
-0
lines changed

.idea/.gitignore

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/PythonTkinter.iml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

+33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.py

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import customtkinter
2+
import sqlite3
3+
import tkinter
4+
5+
6+
connection = sqlite3.connect('users.db')
7+
8+
cursor = connection.cursor()
9+
10+
command1 = """CREATE TABLE IF NOT EXISTS
11+
USERS(username text, password text)
12+
"""
13+
14+
cursor.execute(command1)
15+
16+
cursor.execute("INSERT INTO USERS VALUES('user1', 'password1')")
17+
cursor.execute("INSERT INTO USERS VALUES('user2', 'password2')")
18+
cursor.execute("INSERT INTO USERS VALUES('user3', 'password3')")
19+
cursor.execute("INSERT INTO USERS VALUES('user4', 'password4')")
20+
cursor.execute("INSERT INTO USERS VALUES('user5', 'password5')")
21+
22+
23+
24+
25+
customtkinter.set_appearance_mode("light")
26+
customtkinter.set_default_color_theme("blue")
27+
28+
app = customtkinter.CTk()
29+
app.title("Turtle Code Youtube Log In System")
30+
app.geometry("960x540")
31+
32+
bottomframe = tkinter.Frame(app)
33+
bottomframe.pack(expand = True)
34+
35+
def button_event():
36+
cursor.execute("SELECT * from USERS")
37+
results = cursor.fetchall()
38+
39+
for result in results:
40+
if user_name.get() == result[0] and password.get() == result[1]:
41+
label.set_text("Correct")
42+
break
43+
else:
44+
label.set_text("Wrong")
45+
46+
user_name = customtkinter.CTkEntry(master=bottomframe,
47+
placeholder_text="Username",
48+
text_font=('Helvetica',28),
49+
width=800,
50+
height=100,
51+
border_width=2,
52+
corner_radius=10)
53+
user_name.pack()
54+
55+
password = customtkinter.CTkEntry(master=bottomframe,
56+
placeholder_text="Password",
57+
text_font=('Helvetica', 28),
58+
width=800,
59+
height=100,
60+
border_width=2,
61+
corner_radius=10)
62+
password.pack()
63+
64+
button = customtkinter.CTkButton(master=bottomframe,
65+
width=500,
66+
height=100,
67+
border_width=0,
68+
corner_radius=8,
69+
text="Log In",
70+
text_font=('Helvetica', 28),
71+
command=button_event)
72+
button.pack()
73+
74+
75+
label = customtkinter.CTkLabel(master=bottomframe,
76+
text="",
77+
text_color="black",
78+
width=200,
79+
height=100,
80+
text_font=('Helvetica', 28),
81+
fg_color=("white"),
82+
corner_radius=8
83+
)
84+
label.pack()
85+
86+
87+
app.mainloop()

users.db

8 KB
Binary file not shown.

0 commit comments

Comments
 (0)