[wxPython-users] Capturing mouse position in wx.Grid

Mike Driscoll mdriscoll at co.marshall.ia.us
Tue Mar 4 07:42:16 PST 2008


Robin,

> -----Original Message-----
> From: Robin Dunn [mailto:robin at alldunn.com] 
> Sent: Friday, February 29, 2008 4:57 PM
> To: wxPython-users at lists.wxwidgets.org
> Subject: Re: [wxPython-users] Capturing mouse position in wx.Grid
> 
> Mike Driscoll wrote:
> 
> > In my handler, I was using GetPosition(), but that always 
> returns the 
> > same tuple no matter where I move the mouse.
> 
> The mouse event's GetPosition()?  Strange, that should be working... 
> Can you make a small sample?
> 
> > Right now, what I want is to be
> > able to mouse over any cell in a certain column and grab 
> that cell's 
> > contents and multiply it by a value which is then displayed in the 
> > tooltip.
> > 
> > I'm sure there's a way to get the mouse position and 
> translate it into 
> > a (row, col) tuple, but I just don't see how to do it at the moment.
> 
> 	coords = grid.XTToCell(x, y)
> 
> --

Thanks for the code, but it looks like you made that one up. Fortunately
it was close enough to the real call that I found the correct one:

coords = grid.XYToCell(x, y)

Thanks again for pointing me in the right direction!

Mike




More information about the wxpython-users mailing list