On Sat, 1 Jul 2000, Bellamy Bruno wrote:
> Oops, sorry I didn't reply earlier... Lots of work. ;)
>
> On 20-Jun-2000 James Henstridge wrote:
> > On Tue, 20 Jun 2000, Bellamy Bruno wrote:
> >> I'm trying to catch the key_release event in a GtkText, so I had to
> >> use a mygtktext.add_events(GDK.KEY_RELEASE_MASK).
> >> But it seems to work only after I start by clicking in
> >> the GtkText with the mouse. Otherwise, no key_release event is detected.
> >
> > The widget will only receive key press events if it has focus. That could
> > be what the problem you are seeing. Does the problem go away if you call
> > text_widget.grab_focus() ?
>
> I do call mygtktext.grab_focus() and it doesn't make any difference.
> I can type text, but I cannot catch the key-release event.
>
> On 20-Jun-2000 Matt Wilson wrote:
> > Add:
> > mygthtext.set_events (KEY_RELEASE_MASK)
>
> Doesn't make any difference either... Sigh.
>
> So, I'm really stuck with this, because I need to check the key_release event
> and one of the main interests in my project is that it wouldn't need any mouse
> action...
>
> Should I generate a fake mouse click? But I just don't know at all the syntax
> for this (and I wonder if it's a good way to solve the problem).
>
> Here's a little source script to show the problem (it's supposed to display
> 'Press' and 'Release' following the events... But 'Release' never happens
> unless there has been a mouse click in the window):
>
I didn't have any trouble with your example when I removed the set_events
call. Set_events sets the mask for all events that you are interested
in. I am sure you were not just interested in key releases. The
add_events variant is usually the one you want.
James.
--
Email: [EMAIL PROTECTED]
WWW: http://www.daa.com.au/~james/
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk