Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. BLUE  = 1
  4. RED   = 2
  5. GREEN = 3
  6.  
  7. def bg1():
  8.     root.configure(background="blue".format(clicks))
  9.  
  10. def bg2():
  11.     root.configure(background="red".format(clicks))
  12.  
  13. def bg3():
  14.     root.configure(background="green".format(clicks))
  15.  
  16. def Clicker():
  17.     global clicks
  18.     global flag
  19.     clicks += 1
  20.     root.title("Clicks {}".format(clicks))
  21.    
  22. if color == BLUE:
  23.     bg1()
  24.     color = RED
  25.  
  26. elif color == RED:
  27.    bg2()
  28.    color = GREEN
  29.  
  30. elif color == GREEN:
  31.    bg3()
  32.    color = BLUE
  33.  
  34. else:
  35.    pass
  36.  
  37. clicks = 0
  38. color  = BLUE
  39. root = Tk()
  40. root.geometry("400x200")
  41. root.configure()
  42. but = Button(width=30, command=Clicker)
  43. but.pack()
  44. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement