# coding=gbk# window.geometry('200x100') 是x不是*# 功能:见链接的动态图:import tkinterwindow = tkinter.Tk()window.title("jkn1234")window.geometry('200x100')#是x不是*#var是标签要显示的文字var = tkinter.StringVar()flag = Falsecount = 0#f是点击按钮时要执行的函数def f(): global count, flag if flag == False: count+=1 flag = True var.set("you hit me {}".format(count)) else: count+=1 flag = False var.set("you hit me {}".format(count))#定义lable标签lable = tkinter.Label( window, textvariable = var, font=('Arial', 12),bg = 'red',width=15,height=2)lable.pack()# 固定标签位置,不加显示不出来#定义button按钮button = tkinter.Button( window, text = "hit me", width = 15, height = 5, command = f # f是点击按钮时要执行的函数)button.pack()# 固定标签位置,不加显示不出来window.mainloop()