import threading import time class Clock(threading.Thread): def __init__(self,cb): super(Clock, self).__init__() self.running = False self.cb=cb def run(self): self.running=True self.handleTime() def handleTime(self): while True: self.cb(time.strftime("%H:%M")) time.sleep(10)