inputs icon indicating copy to clipboard operation
inputs copied to clipboard

Allow one to only get input when a spacific window is focused

Open frastlin opened this issue 7 years ago • 1 comments

Hello, I don't want to log all key commands to my game when the user is not focused on the game window. There should be an attribute of inputs that one can set to only capture input of a specific window. Here is what I found: The second answer claims to be cross-platform Getting Window Title on Windows OSX get active window

The problem is that all these require something like win32. I know pygame can tell if the game window is focused without these dependencies. I wonder if the same process can let inputs know that the window has changed focus? Thanks,

frastlin avatar Dec 03 '18 12:12 frastlin

inputs doesn't bind to a specific window as far as I am aware, it accesses the input directly. you could check if your window is active/in focus and ignore input if it isn't. If you want to only track mouse input that is in an active window you will need to calculate when the mouse is in the mouse window yourself.

I'm fairly sure this is out of the scope of inputs

Sartek avatar Feb 15 '19 21:02 Sartek