pyudev.wx
– wxPython integration¶
Wx integration.
MonitorObserver
integrates device monitoring into the wxPython_
mainloop by turing device events into wx events.
wx
from wxPython_ must be available when importing this module.
New in version 0.14.
-
class
pyudev.wx.
MonitorObserver
(monitor)¶ An observer for device events integrating into the
wx
mainloop.This class inherits
EvtHandler
to turn device events into wx events:>>> from pyudev import Context, Monitor >>> from pyudev.wx import MonitorObserver >>> context = Context() >>> monitor = Monitor.from_netlink(context) >>> monitor.filter_by(subsystem='input') >>> observer = MonitorObserver(monitor) >>> def device_event(event): ... print('action {0} on device {1}'.format(event.device.action, event.device)) >>> observer.Bind(EVT_DEVICE_EVENT, device_event) >>> monitor.start()
This class is a child of
wx.EvtHandler
.New in version 0.17.
-
enabled
¶ Whether this observer is enabled or not.
If
True
(the default), this observer is enabled, and emits events. Otherwise it is disabled and does not emit any events.
-
Events
MonitorObserver
posts the following event:
-
pyudev.wx.
EVT_DEVICE_EVENT
¶ Emitted upon any device event. Receivers get a
DeviceEvent
object as argument.
-
class
pyudev.wx.
DeviceEvent
¶ Argument object for
EVT_DEVICE_EVENT
.Deprecated members
Deprecated API¶
-
class
pyudev.wx.
WxUDevMonitorObserver
(monitor)¶ An observer for device events integrating into the
wx
mainloop.Deprecated since version 0.17: Will be removed in 1.0. Use
MonitorObserver
instead.-
enabled
¶ Whether this observer is enabled or not.
If
True
(the default), this observer is enabled, and emits events. Otherwise it is disabled and does not emit any events.
-
Events
WxUDevMonitorObserver
posts the following events in addition to
EVT_DEVICE_EVENT
:
-
pyudev.wx.
EVT_DEVICE_ADDED
¶ Emitted if a
Device
is added (e.g a USB device was plugged). Receivers get aDeviceAddedEvent
object as argument.Deprecated since version 0.17: Will be removed in 1.0.
-
pyudev.wx.
EVT_DEVICE_REMOVED
¶ Emitted if a
Device
is removed (e.g. a USB device was unplugged). Receivers get aDeviceRemovedEvent
object as argument.Deprecated since version 0.17: Will be removed in 1.0.
-
pyudev.wx.
EVT_DEVICE_CHANGED
¶ Emitted if a
Device
was somehow changed (e.g. a change of a property). Receivers get aDeviceChangedEvent
object as argument.Deprecated since version 0.17: Will be removed in 1.0.
-
pyudev.wx.
EVT_DEVICE_MOVED
¶ Emitted if a
Device
was renamed, moved or re-parented. Receivers get aDeviceMovedEvent
object as argument.
-
class
pyudev.wx.
DeviceAddedEvent
¶ -
class
pyudev.wx.
DeviceRemovedEvent
¶ -
class
pyudev.wx.
DeviceChangedEvent
¶ -
class
pyudev.wx.
DeviceMovedEvent
¶ Argument objects for
EVT_DEVICE_ADDED
,EVT_DEVICE_REMOVED
,EVT_DEVICE_CHANGED
andEVT_DEVICE_MOVED
.Deprecated since version 0.17: Will be removed in 1.0.