Thank you, very good info. Manymouse looks like very useful for my needs. I 
am prototyping bitmap editor now, probably it will grow into something 
serious, I have very good ideas in this direction.  But on the other hand 
would be nice to stay with pygame, writing in python is just a pleasure, so 
to this time I almost forgot all my adventures with C.
BTW, I have tested now the pygame's mouse a bit more and I take my words 
back about the loop frequency and cursor speed - so it is all OK, the 
movements are precise and equal at all FPS, but yes, indeed the movement 
speed calculated out of get_rel() looks exactly the same as system cursor 
speed. It is not really bad actually, though no chance to overcome OS-level 
setups.

On Friday, January 16, 2015 at 1:46:53 AM UTC+1, Weeble wrote:
>
> Oops, I meant to reply to the list. Resending: 
>
> Maybe you could use something like manymouse[1] and interface to it 
> with ctypes? It's a cross-platform C library for low-level mouse 
> input. On Windows it uses raw input[2] which gets raw movement data 
> with no acceleration applied[3]. Of course, you could write directly 
> for the Windows API, but I think manymouse looks a bit easier and will 
> be handy if you want to use other platforms. Using ctypes can be a bit 
> tricky if you're new to it, but this API looks extremely 
> straightforward, so I don't think it should be too painful. 
>
> [1] - http://icculus.org/manymouse/ 
> [2] - 
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms645543(v=vs.85).aspx
>  
> [3] - 
> http://msdn.microsoft.com/en-us/library/windows/desktop/ee418864%28v=vs.85%29.aspx
>  
>
> On 16 January 2015 at 00:01, Mikhail V <mikha...@gmail.com <javascript:>> 
> wrote: 
> > Wow that works! Thanks a lot, you made my day. It is however not truely 
> > low-level, since the values depend on my loop frequency, but anyway 
> solves 
> > my tasks at 100%. And yes the trick is not obvious at ALL. It is very 
> good 
> > reason to add this info to pygame official documentation since its a 
> very 
> > common task. 
> > 
> > On Friday, January 16, 2015 at 12:26:18 AM UTC+1, Weeble 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 <mikha...@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 
> >> > 
> >> > 
>

Reply via email to