Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Python3 School Application for DB
- #--- IMPORTS ---
- from tkinter import *
- import mysql.connector
- #--- USERDATA ---
- hostname = '51-254-95-222.server.leonenneken.io'
- portname = '1723'
- username = 'schule'
- password = 'Bita2017'
- database = 'school'
- #--- CODE ---
- root = Tk()
- root.title("Login")
- root.geometry("270x210")
- root.resizable(width=False, height=False)
- #--- MAINFUNCTION ---
- def connect():
- if username_entry.get() == "schule" and password_entry.get() == "Bita2017":
- root.destroy()
- con_win = Tk()
- con_win.title("Database")
- con_win.geometry("500x500")
- con_win.resizable(width=False, height=False)
- else:
- error_lbl.configure(text="Login fehlgeschlagen")
- #--- WIDGETS ---
- login_lbl = Label(root, text="Bitte melden sie sich an:").place(relx=0.01, rely=0.08)
- login_btn = Button(root, text="Login", command=connect).place(relx=0.35, rely=0.7)
- password_lbl = Label(text="Password:").place(relx=0.1, rely=.45)
- password_entry = Entry(root,show="*").place(relx=0.1, rely=0.55) # <-- HERE IS PASSWORD ENTRY
- username_lbl = Label(text="Username:").place(relx=0.1, rely=0.25)
- username_entry = Entry(root).place(relx=0.1 , rely=0.35) # <-- HERE IS USERNAME ENTRY
- error_lbl = Label(text="").place(relx=0.1, rely=0.85)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement