scipiguy

GUIZero Flashing PushButton

Nov 17th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. from guizero import App, PushButton, Text
  2.  
  3. def buttonflash():
  4.     if button.bg == "black":
  5.         button.bg = "white"
  6.     else:
  7.         button.bg = "black"
  8.  
  9. app = App("Flashing Button")
  10.  
  11. text = Text(app, text="Here is a flashing button")
  12. button = PushButton(app, text="Push Button")
  13. button.bg = "black"
  14. button.repeat(1000, buttonflash)
  15.  
  16. app.display()
Advertisement
Add Comment
Please, Sign In to add comment