I have a simulation written using pygame that makes use of a joystick. I have a two monitor setup, and I would like to be able to use the system on the non-game monitor while a second person is using the joystick to interact with the simulator. As is, the joystick stops sending events to the simulator if I click on a non-simulator window. I understand that I can keep the joystick focus on pygame with pygame.event.set_grab(True)
, but this would also keep the mouse and keyboard focus on the pygame window. Is there a way to have only the joystick captured by pygame while leaving the mouse and keyboard to be available to all windows? I am running in Windows 10.
To be clear, my question is not about using the device, which is the subject of this question. My question is more about controlling which running program is sent joystick events, mouse events, and keyboard events. I would like a way to have all joystick events go to the pygame application while keyboard and mouse events are sent to another application.