Advertisement
zhongnaomi

gui 9 highlight

Sep 10th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. # Import the GUI widgets that you'll be using, and create the 'app' for your program.
  2. from guizero import App, TextBox, PushButton, Text, info,error
  3. app = App()
  4.  
  5. # Function definitions for your events go here.
  6. def btn_go_clicked():
  7.     if first_password.value == second_password.value:
  8.         info("Greetings","your password is  " + first_password.value  )
  9.     else:
  10.         error("Greetings","Please; enter the same password. Please,try again")
  11.        
  12. def highlight():
  13.     first_password.bg = "light blue"
  14.     second_password.bg = "light green"
  15.  
  16. def lowlight():
  17.     first_password.bg = None
  18.     second_password.bg = None
  19.        
  20.    
  21.  
  22. # Your GUI widgets go here
  23. q1_password = Text(app, text="Please; enter your password")
  24. first_password = TextBox(app)
  25. first_password.when_mouse_enters = highlight
  26. first_password.when_mouse_leaves = lowlight
  27. q2_password= Text(app, text="Enter once again your password")
  28. second_password = TextBox(app)
  29. second_password.when_mouse_enters = highlight
  30. second_password.when_mouse_leaves = lowlight
  31. btn_go = PushButton(app, command=btn_go_clicked, text="Done")
  32.  
  33. # Show the GUI on the screen
  34. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement