Advertisement
Guest User

SCHOOLSYSTEM-APP

a guest
Jan 24th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. #Python3 School Application for DB
  2.  
  3. #--- IMPORTS ---
  4.  
  5. from tkinter import *
  6. import mysql.connector
  7.  
  8. #--- USERDATA ---
  9.  
  10. hostname = '51-254-95-222.server.leonenneken.io'
  11. portname = '1723'
  12. username = 'schule'
  13. password = 'Bita2017'
  14. database = 'school'
  15.  
  16. #--- CODE ---
  17.  
  18. root = Tk()
  19. root.title("Login")
  20. root.geometry("270x210")
  21. root.resizable(width=False, height=False)
  22.  
  23. #--- MAINFUNCTION ---
  24.  
  25. def connect():
  26.     if username_entry.get() == "schule" and password_entry.get() == "Bita2017":
  27.         root.destroy()
  28.         con_win = Tk()
  29.         con_win.title("Database")
  30.         con_win.geometry("500x500")
  31.         con_win.resizable(width=False, height=False)
  32.     else:
  33.         error_lbl.configure(text="Login fehlgeschlagen")
  34.  
  35. #--- WIDGETS ---
  36. login_lbl = Label(root, text="Bitte melden sie sich an:").place(relx=0.01, rely=0.08)
  37. login_btn = Button(root, text="Login", command=connect).place(relx=0.35, rely=0.7)
  38. password_lbl = Label(text="Password:").place(relx=0.1, rely=.45)
  39. password_entry = Entry(root,show="*").place(relx=0.1, rely=0.55) # <-- HERE IS PASSWORD ENTRY
  40. username_lbl = Label(text="Username:").place(relx=0.1, rely=0.25)
  41. username_entry = Entry(root).place(relx=0.1 , rely=0.35) # <-- HERE IS USERNAME ENTRY
  42. error_lbl = Label(text="").place(relx=0.1, rely=0.85)
  43.  
  44. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement