You can easily get the mouse position regardless of focus under Windows using the win32api:
mouse_pos = win32api.GetCursorPos() On Thu, Jan 15, 2015 at 3:26 PM, Weeble <clockworksa...@gmail.com> wrote: > It is possible, just not entirely obvious. I believe you need to: > > 1. Grab mouse focus with pygame.event.set_grab() > 2. Hide the mouse cursor with pygame.mouse.set_visible() > 3. Read mouse events, taking the rel.x and rel.y properties to find > the relative mouse motion. > > Make sure to have a way to release the grab, otherwise your app will > be difficult to get out of! > > I haven't tried this lately, but I'm sure I've done it in the past. > Here's the documentation for SDL, which Pygame is built on top of, and > which describes the mouse motion events in a bit more detail: > http://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlmousemotionevent.html > > On 15 January 2015 at 23:05, Mikhail V <mikhail...@gmail.com> wrote: > > Hello pygame devs and users, > > > > I have a simple task - I want to read input from the mouse - NOT the > cursor > > position inside my window, but the actual input data from the device. > > So currently I suppose it is not possible with Pygame. Is there a > possiblity > > to add such capabilities to Pygame? I know that depends on the device > type > > and connection so it is impossible to implement tools for all devices. > But > > having tools to read low-level input at least for the mouse is > absolutely a > > must for developing interactive applications. > > > > If there is no chance with pygame then what would you recommend, say, > for > > Windows and C/C++ to read from the mouse at low level? > > > > Mikhail > > > > >