Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- BLUE = 1
- RED = 2
- GREEN = 3
- def bg1():
- root.configure(background="blue".format(clicks))
- def bg2():
- root.configure(background="red".format(clicks))
- def bg3():
- root.configure(background="green".format(clicks))
- def Clicker():
- global clicks
- global flag
- clicks += 1
- root.title("Clicks {}".format(clicks))
- if color == BLUE:
- bg1()
- color = RED
- elif color == RED:
- bg2()
- color = GREEN
- elif color == GREEN:
- bg3()
- color = BLUE
- else:
- pass
- clicks = 0
- color = BLUE
- root = Tk()
- root.geometry("400x200")
- root.configure()
- but = Button(width=30, command=Clicker)
- but.pack()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement