Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: ba0b6aeda605bec73c90f93fc05dd1cbc4efa9d3 authored by cvs2svn on 12 January 1995, 12:42:09 UTC
This commit was manufactured by cvs2svn to create tag 'r12beta1'.
Tip revision: ba0b6ae
TestSched.py
#! /usr/local/bin/python

# TestSched

import stdwin
from WindowParent import WindowParent, MainLoop
import WindowSched
from Buttons import PushButton

def my_ringer(child):
	child.my_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)
back to top