Open Source61 opened 10 months ago
Variable set undulatingly on/off worked for me in my program... [on_press(key) / on_release(key)].
Variable set undulatingly on/off worked for me in my program... [on_press(key) / on_release(key)].
No idea what that's supposed to mean.
I don't see any documentation about any variable setting functions or methods.
Using a global variable to try to block the event does NOT work.
That said, I figured out why part of my script was not working. Mouse Controller object's position variable is unreliable. Gotta rely on (x, y) instead when assigning position values.
The event is still being triggered, with no way of suppressing it, which seems like a bug or a huge missing feature, but at least I got my script partially working.
Can confirm that it has the same problem with the keyboard. I think @SpecialCharacter is suggesting turning reading on and off on each key press which seems like it would have a lot of overhead.
@thisthingrighthere If you have an idea how to avoid this overhead, I am all ears :)
@Source61 Sorry for keeping you waiting. Undulating variable is echo:
if chars == 'A':
if echo == False or echo == True:
echo = chars
if ...
else: ...
else:
echo = False
pass
Thank you for your report.
@Source61, as you duly note this is a huge missing feature. The long-living branch feature-injected
attempts to resolve this. Completing the feature for your backend of choice, Xorg, was the blocker.
Reading this report brought me to look at the feature again. Running xev
, events appear to be designated as synthetic when faked, and reading the xev source code revealed what field of the event was responsible for this output.
I have now updated the branch. Is it possible for you to test it? If you update, a new argument will be available for event listeners after the current argument list: injected: bool
. It is supposed to be set for fake events. pynput will handle an event callback argument list without this argument specified.
If this works, can you please backport it?
Python version: 3.11.2 OS: Debian 12 Pynput version: 1.7.6
I'm having the issue that when I set a mouse controller to perform certain sequences of actions with monitoring (which is required to get the mousePos when left and right buttons are clicked) enabled, that events are duplicated for each controller action, i.e. I left click once, the monitoring is triggered which calls a function that moves somewhere and left click somewhere, now the monitoring is triggered again even though the input was from the controller, not a person.
Is it possible to suppress monitoring events triggered by a controller?
I tried using a block variable that is set on/off, but because of threading this variable is ignored / not assigned correctly across threads.