home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import timer
- import time
- import win32event
- import win32gui
-
- class glork:
-
- def __init__(self, delay = 1000, max = 10):
- self.x = 0
- self.max = max
- self.id = timer.set_timer(delay, self.increment)
- self.event = win32event.CreateEvent(None, 0, 0, None)
-
-
- def increment(self, id, time):
- print 'x = %d' % self.x
- self.x = self.x + 1
- if self.x > self.max:
- timer.kill_timer(id)
- win32event.SetEvent(self.event)
-
-
-
-
- def demo(delay = 1000, stop = 10):
- g = glork(delay, stop)
- start_time = time.time()
- while None:
- rc = win32event.MsgWaitForMultipleObjects((g.event,), 0, 500, win32event.QS_ALLEVENTS)
- if rc == win32event.WAIT_OBJECT_0:
- break
- continue
- if rc == win32event.WAIT_OBJECT_0 + 1:
- if win32gui.PumpWaitingMessages():
- raise RuntimeError, 'We got an unexpected WM_QUIT message!'
- win32gui.PumpWaitingMessages()
- continue
- if time.time() - start_time > 30:
- raise RuntimeError, 'We timed out waiting for the timers to expire!'
- time.time() - start_time > 30
- continue
- return None
-
- if __name__ == '__main__':
- demo()
-
-