This is my lazy solution:
import time
import random
from Tkinter import *
class GetClicktime():
def __init__(self):
self.j=0
self.t=[]
self.mgui=Tk()
self.mgui.geometry('200x200')
self.mgui.title('Queue System')
self.st = Button(self.mgui, text="Next Customer", command = self.PrintNumber)
self.st.pack()
#self.st.bind('<Button-1>',callback)
self.label = Label(self.mgui, text=str(self.j))
self.label.pack()
self.mgui.mainloop()
def PrintNumber(self):
self.j+=1
self.label.config(text=str(self.j))
print self.j
t = (time.strftime("%H:%M:%S"))
d = time.strftime("%d/%m/%Y")
self.t.append(int(t.replace(':','')))
print self.t
if self.j >2:
print 'the time between clicks is:',self.t[self.j-1]-self.t[self.j-2],'seconds'
print t,d
return
if __name__ == "__main__":
GetClicktime()
you can avoid writing a class, but this does what you need to.
If you need some docs on classes i recommmend: https://www.youtube.com/watch?v=trOZBgZ8F_c#start=0:00;end=13:27;cycles=-1;autoreplay=false;showoptions=false