traits_futures.wx.pingee module¶
wxPython cross-thread pinger.
This module provides a way for a background thread to request that the main thread execute a (fixed, parameterless) callback.
-
class
traits_futures.wx.pingee.
Pingee
(*args: Any, **kwargs: Any)[source]¶ Bases:
wx.
Receiver for pings.
Whenever a ping is received from a linked Pinger, the receiver calls the given fixed parameterless callable.
The ping receiver must be connected (using the
connect
) method before use, and should calldisconnect
when it’s no longer expected to receive pings.- Parameters
on_ping – Zero-argument callable that’s called on the main thread every time a ping is received.
-
pinger
()[source]¶ Create and return a new pinger linked to this pingee.
This method is thread-safe. Typically the pingee will be passed to a background thread, and this method used within that background thread to create a pinger.
This method should only be called after the ‘connect’ method has been called.
- Returns
pinger – New pinger, linked to this pingee.
- Return type
-
class
traits_futures.wx.pingee.
Pinger
(pingee)[source]¶ Bases:
object
Ping emitter, which can send pings to a receiver in a thread-safe manner.
- Parameters
pingee (
Pingee
) – The target receiver for the pings. The receiver must already be connected.
-
connect
()[source]¶ Connect to the ping receiver. No pings should be sent until this function is called.