from tkinter import *
import time
from tkinter.messagebox import showinfo
tkWindow = Tk()
tkWindow.geometry('400x150')
tkWindow.title('Кнопка счетчик')
def changeText():
global buttoncounter
button['text'] = str(buttoncounter)
buttoncounter = buttoncounter + 1
if (int(time.clock()) >= 10):
showinfo(title="Информация", message="За 10 секунд вы нажали кнопку счетчик "+str(buttoncounter))
exit()
button = Button(tkWindow,text = '+',width = 10,command = changeText)
button.pack()
buttoncounter = 0
tstart = time.clock()
tkWindow.mainloop()
|