On Sunday, 7. March 2010 14:09:47 Pietro Battiston wrote:
> Il giorno dom, 07/03/2010 alle 11.49 +0100, Martin Drautzburg ha
>
> scritto:
> > Hello all,
>> [...]
> >
> > So I thought, I'd better let the gtk.Layout handle the motion events. The
> > strange thing is: it gets motion events only
> >
> > - When the mouse is outside any gtk.Button
> > - When the mouse is inside a gtk.Button but no mousebutton is pressed
> >
> > However no motion events arrive at the Layout when
> > - The mouse is inside a gtk.Button and a mousebutton is held pressed
> >
> > I found two postings related to this issue:
> >
> > - one had the exact same problem, but there were no replies
> > - it was said that gtk.Layout does not respond to events, as it does not
> > have its own window. This is hard to believe, because my Layout does
> > respond to events and I can influence the behavior (except for the
> > problem described here)
>
> Couldn't you look at (mouse) events for the whole window?!
Does it make any difference if I look at the events for the whole window or at
those received in the Layout? I have the impression, that the gtk.Button eats
away the motion events when a mouse button is pressed, so they are no longer
sent to the parent. I don't understand why this happens.
If I let the gtk.Button respond to motion events itself, then the surrounding
Layout receives the event albeit in Button coordinates. If I transform the
coordinates in the gtk.Button's motion event handler as in
coords = self.inLayoutCoordinates(event.x, event.y)
event.x, event.y = coords.x, coords.y
then I get the desired behavior and the Layout recives motion events in its
own coordinates, even when a mouse button is pressed inside a gtk.Button.
However this looks too complicated to me.
--
Martin
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/