diff options
author | Guido van Rossum <guido@python.org> | 1997-09-09 03:39:21 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-09-09 03:39:21 (GMT) |
commit | d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8 (patch) | |
tree | db4a6e4835e04851df721eb4595d7172d8e05c34 /Lib/stdwin/WindowSched.py | |
parent | 045e688f6fc06c87cc93f84e42fb4767a04ba559 (diff) | |
download | cpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.zip cpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.tar.gz cpython-d7500fcbb4d0257f3bcd0c87d17ee61f3b1545e8.tar.bz2 |
These directories renamed: tkinter -> lib-tk, stdwin -> lib-stdwin.
Diffstat (limited to 'Lib/stdwin/WindowSched.py')
-rwxr-xr-x | Lib/stdwin/WindowSched.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/Lib/stdwin/WindowSched.py b/Lib/stdwin/WindowSched.py deleted file mode 100755 index 119a41f..0000000 --- a/Lib/stdwin/WindowSched.py +++ /dev/null @@ -1,62 +0,0 @@ -# Combine a real-time scheduling queue and stdwin event handling. -# Keeps times in milliseconds. - -import stdwin, stdwinq -from stdwinevents import WE_TIMER -import mainloop -import sched -import time - -# Delay function called by the scheduler when it has nothing to do. -# Return immediately when something is done, or when the delay is up. -# -def delayfunc(msecs): - msecs = int(msecs) - # - # Check for immediate stdwin event - # - event = stdwinq.pollevent() - if event: - mainloop.dispatch(event) - return - # - # Use sleep for very short delays or if there are no windows - # - if msecs < 100 or mainloop.countwindows() == 0: - if msecs > 0: - time.sleep(msecs * 0.001) - return - # - # Post a timer event on an arbitrary window and wait for it - # - window = mainloop.anywindow() - window.settimer(msecs/100) - event = stdwinq.getevent() - window.settimer(0) - if event[0] <> WE_TIMER: - mainloop.dispatch(event) - -def millitimer(): - return time.time() * 1000 - -q = sched.scheduler(millitimer, delayfunc) - -# Export functions enter, enterabs and cancel just like a scheduler -# -enter = q.enter -enterabs = q.enterabs -cancel = q.cancel - -# Emptiness check must check both queues -# -def empty(): - return q.empty() and mainloop.countwindows() == 0 - -# Run until there is nothing left to do -# -def run(): - while not empty(): - if q.empty(): - mainloop.dispatch(stdwinq.getevent()) - else: - q.run() |