Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. import tkinter as tk
  2.  
  3. from AgileBooks.controllers.login import submit_login
  4.  
  5. global_font = 'Helvetica'
  6. global_bg = 'gray25'
  7. global_fg = 'lawn green'
  8.  
  9.  
  10. class MainFrame():
  11. # Frame:
  12. frm_login = tk.Tk()
  13. frm_login.title('Login | AgileBooks - Copyright Gonzalo Dambra')
  14. frm_login.geometry('400x300')
  15. frm_login.configure(background=global_bg)
  16. # Labels:
  17. lbl_username = tk.Label(frm_login, text='Username', bg=global_bg, fg=global_fg, font=(global_font, 16))
  18. lbl_username.place(x=150, y=50)
  19. lbl_password = tk.Label(frm_login, text='Password', bg=global_bg, fg=global_fg, font=(global_font, 16))
  20. lbl_password.place(x=150, y=125)
  21. # Inputtexts:
  22. txt_username = tk.Entry(frm_login, font=(global_font, 14))
  23. txt_username.focus()
  24. txt_username.place(x=100, y=80, height=25, width=200)
  25. txt_password = tk.Entry(frm_login, show='*',font=(global_font, 14))
  26. txt_password.place(x=100, y=155, height=25, width=200)
  27. # Button:
  28. btn_login = tk.Button(frm_login, text='Login', font=(global_font, 16), bg=global_bg, fg=global_fg,
  29. command=submit_login(txt_username.get(), txt_password.get()))
  30. btn_login.place(x=165, y=200, height=25)
  31.  
  32.  
  33. def main():
  34. frame = MainFrame()
  35. frame.frm_login.mainloop()
  36.  
  37.  
  38. if __name__ == '__main__':
  39. main()
  40.  
  41. def submit_login(username, password):
  42. if len(username) > 0 and len(password) > 0:
  43. print('Username: ', username, ' | Password: ', password)
  44. else:
  45. print('One of the fields is not filled.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement