[wxPython] Querying mouse buttons

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] Querying mouse buttons

Ben Darnell
I feel like I'm overlooking something obvious here, but I can't find any
way to query the current state of the mouse buttons.  I found
wxGetMousePosition, but no corresponding wxGetMouseButtons.  

-Ben
--
Ben Darnell              [hidden email]
http://thoughtstream.org


_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Querying mouse buttons

Robin Dunn
> I feel like I'm overlooking something obvious here, but I can't find any
> way to query the current state of the mouse buttons.  I found
> wxGetMousePosition, but no corresponding wxGetMouseButtons.
>

Set an event handler for the mouse events and get the values from the event
object.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!





Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] Querying mouse buttons

Ken Seehof-2
In reply to this post by Ben Darnell
Usually if you want to know the mouse button you are in a mouse
event handler, so I'll assume that's the case.

Look at wxMouseEvent.

Example:

 def OnMouseMove (self, e):
    left = e.LeftIsDown();
    right = e.RightIsDown();
    shift = e.ShiftDown()
    ctrl = e.ControlDown()


Ben Darnell wrote:

> I feel like I'm overlooking something obvious here, but I can't find any
> way to query the current state of the mouse buttons.  I found
> wxGetMousePosition, but no corresponding wxGetMouseButtons.
>
> -Ben
> --
> Ben Darnell              [hidden email]
> http://thoughtstream.org
>
> _______________________________________________
> wxPython-users maillist  -  [hidden email]
> http://starship.python.net/mailman/listinfo/wxpython-users