Rnery

Login e senha com Tkinter...

Aug 14th, 2021 (edited)
321
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | Source Code | 1 0
  1. import tkinter as tk
  2.  
  3. window = tk.Tk()
  4.  
  5. # Constantes do tipo string
  6. LOGIN_DIGITADO = tk.StringVar()
  7. SENHA_DIGITADA = tk.StringVar()
  8.  
  9. def submit():
  10.     if LOGIN_DIGITADO.get() == 'Bruno':
  11.         tk.Label(window,
  12.             text = 'Login Digitado').place(x = 10, y = 190)
  13.  
  14.     if SENHA_DIGITADA.get() == 'Bruno':
  15.         tk.Label(window,
  16.             text = 'Senha Digitada').place(x = 10, y = 210)
  17.  
  18. submit()
  19.  
  20. # Customizar o input do Login
  21. label_login = tk.Label(window, text = 'Login')
  22. label_login.place(x = 10, y = 10)
  23. login = tk.Entry(window, textvariable = LOGIN_DIGITADO)
  24. login.place(x = 10, y = 40)
  25.  
  26. # Customizar o input da senha
  27. label_senha = tk.Label(window, text = 'Senha')
  28. label_senha.place(x = 10, y = 70)
  29. senha = tk.Entry(window, textvariable = SENHA_DIGITADA)
  30. senha.place(x = 10, y = 100)
  31.  
  32. # Customizar o botão de verificar
  33. botao_verificar = tk.Button(window,
  34.     text = 'verificar', command = lambda: submit())
  35. botao_verificar.place(x = 10, y = 130)
  36.  
  37. # Customizar o botão de sair
  38. botao_sair = tk.Button(window, text = 'sair',
  39.     command = window.destroy)
  40. botao_sair.place(x = 100, y = 130)
  41.  
  42. # Customizar a window
  43. window.title('Área Administrativa')
  44. window.geometry('300x300')
  45. window.mainloop()
  46.  
Tags: python
Advertisement
Add Comment
Please, Sign In to add comment