Advertisement
Mori007

flip_blackorWhite

Feb 13th, 2021
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. from guizero import App, PushButton
  2.  
  3.    
  4. def flip_color():
  5.     if app.bg == "white":
  6.        app.bg = "black"
  7.     else :
  8.        app.bg = "white"
  9.      
  10. def stop_flip():
  11.     app.destroy()
  12.  
  13. app = App("Flip Colour", bg="white")
  14.  
  15. btn_start = PushButton(app, command=flip_color, text='Recolorize')
  16. btn_stop = PushButton(app, command=stop_flip, text='Stop It')
  17.  
  18. app.repeat(5000, flip_color)
  19.  
  20. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement