Closed bf-malefiz closed 3 years ago
Thank you for your report.
As to the reason for your issues, I can only speculate. It seems plausible that the clipboard has not yet been updated following self.keyboard.release('c')
when you invoke pyperclip; I doubt there is any synchronisation between the system fake event consumer and the system clipboard.
To test this hypothesis, have you tried applying a small delay before calling pyperclip.paste()
?
A time.sleep(0.2) kinda fixed the issue. I am now able to get the data before the mouse gets released but it feels realy inconsistent and I guess I have to adjust the sleep parameter if I want to implement functions with longer runtimes. And obviously it feels kinda clunky ^^
Is there a way to simply flag the mouse and block inputs depending on the flag when the mouse is pressed? Or maybe apply some sync. I guess I have to take Winapi in consideration, right?
I'm afraid that I don't know. If possible, you would have to dive rather deep into the win32 API.
In any case, this is out of scope for this library, so I will close this issue.
I'm trying to copy data on mousepress and execute some code before it gets released with pynput and pyperclip. Sadly I can't make it work. The clipboard is never up to date.
It is getting copied but I can't access it before my mouse gets released. Is it Threads not being handled well by me? Can I somehow synchronize them or supress the release of the mouse to avoid getting data to late? Thanks for your help.