[pygtk] click on image

David Keogh davekeogh at shaw.ca
Wed Nov 1 14:08:26 WST 2006


On 10/31/06, Rodrigo Renie Braga <rodrigorenie at gmail.com> wrote:
>
> yeah, i tried to do that once, and it works at first, but the problem is
> when the windows is scrolled.. the coordinates won't change, for example,
> the upper left corner will always be (0, 0), no matter if the image was
> scrolled or not... so i didn't find a way to know the position of a click=
 on
> an image... not in a scrolled window anyway...
> <http://www.async.com.br/faq/pygtk/>


You can do something like this:

hadj =3D scrolled_window.get_hadjustment()
vadj =3D scrolled_window.get_vadjustment()

hoffset =3D hadj.get_value()
voffset =3D vadj.get_value()

You can add those values to your coordinates, to get the coordinates on the
image itself.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20061031/c4e2757c/at=
tachment.htm


More information about the pygtk mailing list