[pygtk] Resizing a Button with motion_notify_event?
Martin Drautzburg
Martin.Drautzburg at web.de
Sun Mar 7 18:49:49 WST 2010
Hello all,
I am trying to implement a gtk.Button which can be resized (by grabbing it
near its nower edge) and dragged around (by grabbing it somewhere near its
center). The gtk.Button is placed inside a gtk.Layout. I could get this to
work by responding to mouse events WITHIN the Button.
However this had the drawback, that the mouse may be too fast while resizing
and the gtk.Button will not grow fast enough. Thus the mouse will leave the
area of the gtk.Button and no more motion events will be sent to the Button.
When moving the Button around this problem is less obvious, because the mouse
is less likely to leave the area of the Button. None of these problems became
apparent on my desktop box, but on my maemo handheld, the resizing simply
didn't work.
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)
--
Martin
More information about the pygtk
mailing list