Mercurial > fife-parpg
diff clients/pychan_demo/pychan_test.py @ 165:fbc55c6f57cf
(Convenient) Timers.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 15 Oct 2008 18:04:52 +0000 |
parents | c305c5eda7ed |
children | 54bfd1015b35 |
line wrap: on
line diff
--- a/clients/pychan_demo/pychan_test.py Wed Oct 15 14:57:04 2008 +0000 +++ b/clients/pychan_demo/pychan_test.py Wed Oct 15 18:04:52 2008 +0000 @@ -36,6 +36,19 @@ self.widget.hide() self.widget = None +def testTimer(): + import timer + timer.init( pychan.manager.engine.getTimeManager() ) + def spam(): + print "SPAM SPAM" + return 1 + repeater = timer.repeatCall(500,spam) + def stop_spam(): + repeater.stop() + print "BACON EGGS AND SPAM" + timer.delayCall(5000,stop_spam) + + class DemoApplication(basicapplication.ApplicationBase): def __init__(self): super(DemoApplication,self).__init__() @@ -75,6 +88,7 @@ self.currentExample = None self.creditsWidget = None + testTimer() def selectExample(self): if self.demoList.selected_item is None: return