I am working on a script that takes control of my mouse and runs during a simple endless while loop.
def main(): while True: do_mouse_stuff()
Due to mouse control, it is a pain to click on a python window and press ctrl-c, so I was looking for a way to implement a global hotkey in windows. I am also relative Python noob, so I probably missed the obvious answer. The material I found:
pyhk - the closest I got, but for some reason this module does unpleasant things on my computer (maybe something I'm doing wrong), it introduces a big mouse delay, a complete input lock, all kinds of things, m is not smart enough, to deal with.
pyHook - after the tutorial it works fine, but the infinite stream of messages and my while loop work exclusively, and I donβt know, t figured out how to make it work.
Another method - I found this method, but I have the same problem as pyHook, the try loop and my while loop cannot coexist.
I tried to figure out how to integrate my cycle into these examples, rather than maintaining a separate cycle, but I could not do this work, again, probably due to my lack of ability. Can anyone fix me how to make this work?
source share