pdk.Timers ($Date: 2002/12/04 10:13:05 $)
index
pdk/Timers.py

Timing/scheduling of events.

There are two kinds of timers in this module: a generic timer based on a thread (GenericTimer) and a GUI timer based on the GUI main event loop (GuiTimer).

The generic timer is much more accurate than the GUI timer (which will depend on the current load of the main event loop) and is therefore very well suited for time-critical applications like device drivers. However, since it is running in its own thread, it is always somewhat cumbersome to integrate a generic timer into a GUI application, in which case the GUI timer is the preferred solution.

Note that the GuiTimer class is not made available if pdk.Util.guiavailable returns False.

FOG 08.2000

 
Classes
            
ElapsedTimer
GenericTimer
pdk.ThreadingClasses.Thread(threading.Thread)
PeriodicEvent
wxPython.misc2.wxPyTimer(wxPython.misc2.wxPyTimerPtr)
GuiTimer
 
class ElapsedTimer
     
Purpose:measure elapsed time
Detail:the timer starts when the instance is created and is reset every time the .`reset` method is called. Time is measured in milliseconds.

 
   Methods defined here:
__call__(self)
__init__(self)
reset(self)
 
class GenericTimer
     
Purpose:generic scheduling of events using a separate thread
Detail:modelled after wxPython.wx.wxTimer.

 
   Methods defined here:
__init__(self, callBack)
getInterval(self)
isRunning(self)
start(self, timeInterval=250)
stop(self)
 
class PeriodicEvent(pdk.ThreadingClasses.Thread)
     
Purpose:a periodic event implemented as a separate thread

 
  
Method resolution order:
PeriodicEvent
pdk.ThreadingClasses.Thread
threading.Thread
threading._Verbose

Methods defined here:
__init__(self, timeInterval=250, **optionD)
Parameters:
  • timeInterval: (in milliseconds) sets the periodicity
  • optionD : options being passed to the pdk.ThreadingClasses.Thread base class constructor
exit(self)
run(self)
 
class GuiTimer(wxPython.misc2.wxPyTimer)
     
Purpose:a GUI timer for pdk
Detail:depends on the GUI main loop

 
  
Method resolution order:
GuiTimer
wxPython.misc2.wxPyTimer
wxPython.misc2.wxPyTimerPtr
wxPython.misc.wxObjectPtr
 
Functions
            
timer(callBack)
helper function: returns a GuiTimer, if a GUI is available, and a GenericTimer otherwise.
 
Author
            
$Author: gathmann $