CBD.realtime.threadingBackend module¶
- class CBD.realtime.threadingBackend.Platform[source]¶
Bases:
objectIdentifies the platform to use in real-time simulation.
- THREADING = 'python'¶
Use the default Python threading platform.
- PYTHON = 'python'¶
Use the default Python threading platform.
- TKINTER = 'tkinter'¶
Use the TkInter backend, to allow GUIs of the simulation.
- TK = 'tkinter'¶
Use the TkInter backend, to allow GUIs of the simulation.
- GAMELOOP = 'loop'¶
Use a gameloop backend, to keep the time yourself.
- LOOP = 'loop'¶
Use a gameloop backend, to keep the time yourself.
- GLA = 'loop_alt'¶
Use an alternative gameloop backend, to keep the time yourself.
- class CBD.realtime.threadingBackend.ThreadingBackend(subsystem, args)[source]¶
Bases:
objectWrapper around the actual threading backend. It will also handle interrupts and the passing of them to the calling thread.
- Parameters
subsystem (str) – String specifying the subsystem to use. Must be one of
python,tkinterorloop(case-insensitive). ThePlatformclass may be used to help identifying the subsystem.args (list) – All additional arguments that should be passed to the subsystem’s constructor (must be a list). Only used for the
tkintersubsystem.
- is_alive()[source]¶
Checks that the main thread is alive.
- Returns
code`True` when it is alive, otherwise
False.
- wait(time, func)[source]¶
A non-blocking call, which will call the
funcparameter aftertimeseconds. It will use the provided backend to do this.- Parameters
time (float) – Time to wait in seconds.
func (callable) – The function to call after the time has passed.