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