I'm working on a script that grabs control of my mouse and runs within a simple infinite while loop.
def main():
while True:
do_mouse_stuff()
Because of the mouse control, it's a pain to click on the python window and hit ctrl-c, so I've been looking for a way to implement a global hotkey in windows. I'm also a relative Python noob so I've probably missed an obvious answer. Stuff I've found:
pyhk - the closest I've gotten, but this module does nasty things to my computer for some reason (probably something I'm doing wrong), it introduces major mouse lag, complete input lockout, all kinds of stuff I'm not smart enough to deal with.
pyHook - Followed the tutorial, works fine but the infinite running message pump and my while loop appear to run exclusively and I haven't figured out how to make it work.
Another Method - I found this method as well, but I have the same problem as pyHook, the try loop and my while loop cannot coexist.
I've tried to figure out how to integrate my loop into these examples rather than maintaining a separate loop but I've not been able to make that work, again likely due to my noobishness. Would someone be able to straighten me out on how to make this work?