SHARE
TWEET

Untitled

a guest Sep 21st, 2019 179 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3.  
  4. from tkinter import *
  5. import tkinter.messagebox as tm
  6. import os, sys
  7.  
  8.  
  9. class LoginFrame(Frame):
  10.     def __init__(self, master):
  11.         super().__init__(master)
  12.  
  13.         self.label_username = Label(self, text="Username", fg='blue')
  14.         self.label_password = Label(self, text="Password", fg='blue')
  15.  
  16.         self.entry_username = Entry(self)
  17.         self.entry_password = Entry(self, show="*", fg='red')
  18.  
  19.         root.title('Reverse Engineering Test for R2') # title win
  20.  
  21.        
  22.         self.label_username.grid(row=0, sticky=E)
  23.         self.label_password.grid(row=1, sticky=E)
  24.         self.entry_username.grid(row=0, column=1)
  25.         self.entry_password.grid(row=1, column=1)
  26.  
  27.         self.checkbox = Checkbutton(self, text="Keep me logged in")
  28.         self.checkbox.grid(columnspan=2)
  29.  
  30.         self.logbtn = Button(self, text="Login", command=self._login_btn_clicked)
  31.         self.logbtn.grid(columnspan=2)
  32.  
  33.         self.pack()
  34.  
  35.     def _login_btn_clicked(self):
  36.         print("Clicked")
  37.         username = self.entry_username.get()
  38.         password = self.entry_password.get()
  39.  
  40.         print(username, password)
  41.  
  42.         if username == "david" and password == "12345":
  43.             tm.showinfo("Login info", "Welcome david")
  44.         else:
  45.             tm.showerror("Login error", "Incorrect username")
  46.  
  47. root = Tk()
  48. root.geometry('400x100') #size windwos
  49. lf = LoginFrame(root)
  50. root.mainloop()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top