Closed suurjaak closed 3 years ago
Thank you for your report.
I suppose this could be solved in a different manner; perhaps with a class attribute. But what is your user case? Why would you want to subclass a listener rather than just encapsulate it?
Use case was keeping all mouse/keyboard event handling specifics in two thread instances that can be started and destroyed any number of times, forwarding their processed results to the owning object. Subclassing Listener to encapsulate input-specific event processing just seemed.. neater. Already provides a start-stop mechanism.
When subclassing Listener, the OS-specific keyword arguments like
win32_event_filter
no longer work.It's because
pynpyt.keyboard._base.Listener
andpynpyt.mouse._base.Listener
currently useself.__class__
to register keyword arguments as options:So if
pynput.keyboard.Listener
has been subclassed in user code, thatself.__class__
is now from another module altogether instead ofpynpyt.keyboard._win32
, and thuswin32_event_filter
does not get registered in options.Perhaps the argument handling could be achieved in another way that does not break when subclassing?