summaryrefslogtreecommitdiffstats
path: root/Demo/stdwin/TestSched.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-03-30 10:54:51 (GMT)
committerGuido van Rossum <guido@python.org>1992-03-30 10:54:51 (GMT)
commit9cf8f3372c3b7896b085e590c1a11373b58695fb (patch)
tree024c99b4964dee21aa8bb0f37f641f5b18bad2cc /Demo/stdwin/TestSched.py
parent7ebb23c6375a028eb8a5f0a20a2e04652b977803 (diff)
downloadcpython-9cf8f3372c3b7896b085e590c1a11373b58695fb.zip
cpython-9cf8f3372c3b7896b085e590c1a11373b58695fb.tar.gz
cpython-9cf8f3372c3b7896b085e590c1a11373b58695fb.tar.bz2
Initial revision
Diffstat (limited to 'Demo/stdwin/TestSched.py')
-rwxr-xr-xDemo/stdwin/TestSched.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/Demo/stdwin/TestSched.py b/Demo/stdwin/TestSched.py
new file mode 100755
index 0000000..7760cc0
--- /dev/null
+++ b/Demo/stdwin/TestSched.py
@@ -0,0 +1,38 @@
+#! /usr/local/python
+
+# TestSched
+
+import stdwin
+from WindowParent import WindowParent, MainLoop
+import WindowSched
+from Buttons import PushButton
+
+def my_ringer(child):
+ child.id = None
+ stdwin.fleep()
+
+def my_hook(child):
+ # schedule for the bell to ring in N seconds; cancel previous
+ if child.my_id:
+ WindowSched.cancel(child.my_id)
+ child.my_id = \
+ WindowSched.enter(child.my_number*1000, 0, my_ringer, child)
+
+def main(n):
+ from CSplit import CSplit
+
+ window = WindowParent().create('TestSched', (0, 0))
+ csplit = CSplit().create(window)
+
+ for i in range(n):
+ child = PushButton().define(csplit)
+ child.my_number = i
+ child.my_id = None
+ child.settext(`(i+n-1)%n+1`)
+ child.hook = my_hook
+
+ window.realize()
+
+ WindowSched.run()
+
+main(12)