Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. from time import *
  2. from guizero import *
  3.  
  4.  
  5. ########################### First Part ###########################
  6. if 0:
  7.     class relogio():
  8.  
  9.         countDownMinutes = 2
  10.         countDownSeconds = 0
  11.  
  12.  
  13.     def countdown(t):
  14.         while relogio.countDownMinutes >= 0 and relogio.countDownSeconds >= 0:
  15.             if relogio.countDownSeconds >= 10:
  16.                 print("timer:", relogio.countDownMinutes, ":", relogio.countDownSeconds)
  17.             else:
  18.                 print("timer:", relogio.countDownMinutes, ": 0", relogio.countDownSeconds)
  19.             if relogio.countDownSeconds <= 0:
  20.                 relogio.countDownSeconds = 59
  21.                 relogio.countDownMinutes -= 1
  22.             else:
  23.                 relogio.countDownSeconds -= 1
  24.  
  25.             sleep(1)
  26.  
  27.  
  28.     countdown(10)
  29.  
  30.  
  31. ########################### Second Part ###########################
  32. def blinkBtn():
  33.     if btnTrick.bg == "red":
  34.         btnTrick.bg = "black"
  35.         btnTrick.text_color="white"
  36.     else:
  37.         btnTrick.bg = "red"
  38.         btnTrick.text_color = "Black"
  39.  
  40.  
  41. app = App("Push Button Color")
  42. btnTrick = PushButton(app, text="Color")
  43. btnTrick.bg="red"
  44. btnTrick.repeat(1000, blinkBtn)
  45.  
  46. app.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement