Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from appJar import gui
- from tkinter import messagebox, Label, Button, FALSE, Tk, Entry
- import time
- def login():
- def try_login():
- Admin = ("Tom")
- password = ("a")
- User_1 = ("User1")
- password_User1 = ("b")
- User_2 = ("User2")
- password_User2 = ("c")
- print("Trying to login...")
- if Admin_guess.get() == Admin and password_guess.get() == password:
- messagebox.showinfo("-- COMPLETE --", "You Have Now Logged In.", icon="info")
- app = gui()
- print('Admin loged in')
- file = open("Log_ins.txt", 'a')
- file.write('nnAdmin logged in: ' + time.strftime('%X %x %Z'))
- file.close()
- window.destroy()
- #Admin_window()#This goes to the admin page but i dont belive that is needed to solve this issue
- elif Admin_guess.get() == User_1 and password_guess.get() == password_User1:
- messagebox.showinfo("-- COMPLETE --", "You Have Now Logged In.", icon="info")
- print('User 1 loged in')
- file = open("Log_ins.txt", 'a')
- file.write('nnUser1 logged in: ' + time.strftime('%X %x %Z'))
- file.close()
- elif Admin_guess.get() == User_2 and password_guess.get() == password_User2:
- messagebox.showinfo("-- COMPLETE --", "You Have Now Logged In.", icon="info")
- print('User2 loged in')
- file = open("Log_ins.txt", 'a')
- file.write('nnUser2 logged in: ' + time.strftime('%X %x %Z'))
- file.close()
- else:
- messagebox.showinfo("-- ERROR --", "Please enter valid infomation!", icon="warning")
- #Gui Things
- window = Tk()
- window.overrideredirect(1)
- window.wm_attributes("-topmost", 1)
- window.resizable(width=False, height=False)
- window.title("Log-In")
- window.geometry("200x150")
- #Creating the username & password entry boxes
- username_text = Label(window, text="Username:")
- Admin_guess = Entry(window)
- password_text = Label(window, text="Password:")
- password_guess = Entry(window, show="*")
- #attempt to login button
- attempt_login = Button(text="Login", command=try_login)
- username_text.pack()
- Admin_guess.pack()#####LBL
- password_text.pack()
- password_guess.pack()####LBL
- attempt_login.pack()
- #Main Starter
- global root
- root = Tk()
- w, h = root.winfo_screenwidth(), root.winfo_screenheight()
- root.configure(bg = 'Black')
- root.overrideredirect(1)
- LabelM = Label(root, text = 'Backdrop', bg = 'Red', fg = 'Green',)
- LabelM.config(font=("Courier", 44))
- LabelM.pack()
- root.geometry("%dx%d+0+0" % (w, h))
- root.mainloop()
- window.mainloop()
- login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement