#Python 2.7.1 #Combat. No copyright. import random import Tkinter import time #import socket import sys import Dialog import threading class AThread(threading.Thread): def __init__(self, args): threading.Thread.__init__(self) self.setDaemon(True) self.args = args def run(self): while True: time.sleep(1.) t = time.time() + 4. #evil infinite loop print "A evil" while t > time.time(): print "evil!" #<--- point 1 pass print "A good" class BThread(threading.Thread): def __init__(self, args): threading.Thread.__init__(self) self.setDaemon(True) self.args = args def run(self): i = 0 while True: print "B running" #<--- point 2 i += 1 self.args[0].config(text = str(i)) time.sleep(0.1) class App: def __init__(self, window): self.theWindow = window self.frame = Tkinter.Frame(window) self.frame.pack() self.label = Tkinter.Label(self.frame, text = "0") self.label.pack() random.seed(hash(time.time()) + hash(time.clock())) def run(self): try: self.theWindow.title("E ") th = AThread(args=()) th.start() th = BThread(args=(self.label,)) th.start() self.theWindow.mainloop() print "Done" except Exception as e: print e finally: pass #Run baby run App(Tkinter.Tk()).run()