How can I exit the program on specified user input when in another window? /u/timosaurus-rex Python Education

I have a program that plays a mobile game on an emulator for me, so the first thing it does is open another window over VSCode.

It moves the mouse around quite fast so I can’t always get back to VSCode to exit the program.

Can someone help me figure out a way of having the program recognise a specified user input (like pressing ‘q’ or something) even when I’m in another window and then exiting the program when that is deteced?

I was thinking some kind of multi-threaded monitor daemon to just constantly check if ‘q’ has been pressed but I’m quite new to this so would love to hear of any better suggestions.

FYI Ctrl+C doesn’t work when I’m in another window, already tried that.

submitted by /u/timosaurus-rex
[link] [comments]

​r/learnpython I have a program that plays a mobile game on an emulator for me, so the first thing it does is open another window over VSCode. It moves the mouse around quite fast so I can’t always get back to VSCode to exit the program. Can someone help me figure out a way of having the program recognise a specified user input (like pressing ‘q’ or something) even when I’m in another window and then exiting the program when that is deteced? I was thinking some kind of multi-threaded monitor daemon to just constantly check if ‘q’ has been pressed but I’m quite new to this so would love to hear of any better suggestions. FYI Ctrl+C doesn’t work when I’m in another window, already tried that. submitted by /u/timosaurus-rex [link] [comments] 

I have a program that plays a mobile game on an emulator for me, so the first thing it does is open another window over VSCode.

It moves the mouse around quite fast so I can’t always get back to VSCode to exit the program.

Can someone help me figure out a way of having the program recognise a specified user input (like pressing ‘q’ or something) even when I’m in another window and then exiting the program when that is deteced?

I was thinking some kind of multi-threaded monitor daemon to just constantly check if ‘q’ has been pressed but I’m quite new to this so would love to hear of any better suggestions.

FYI Ctrl+C doesn’t work when I’m in another window, already tried that.

submitted by /u/timosaurus-rex
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *