On Fri, 29 Sep 2000, Dave Belfer-Shevett wrote:

> This is -OUTSTANDING- information.  I have just one teeny weeny question,
> which will cement me as a Newbie. :)

We where all newbies once. 
 
> On Fri, 29 Sep 2000, Alexandre Fayolle wrote:
> > struct GdkEventKey
> >   {
> >     GdkEventType type;
> >     GdkWindow *window;
> >     gint8 send_event;
> >     guint32 time;
> >     guint state;
> >     guint keyval;
> >     gint length;
> >     gchar *string;
> >   };
> > 
> Etc.  I understand that it's an GdkEventKey struct.  There's a lot of
> structures returned from GTK.  I understand there are methods associated
> with Objects that come back (ala a 'set_text' associated with a GtkEntry
> field, etc).  
> 
> But how do I retrieve values from the structure?  ala, 'gint' is within
> the structure.  How do I get that value, with an explicit
> get_gint() method associated with the object?

Ahem. In the above snippet of doc, 'gint' is a type, not a member. ;o)

The python mappings are very easy to use: the keyevent parameter you get
is a python object with attributes that match the names of the C structure
members. If you want to react on a ^C, for example, you can do something
like:

import GDK
def keyevent_handler(widget,keyevent):
    if keyevent.keyval=GDK.C and keyevent.state=GDK.CONTROL_MASK:
        # do something here
        pass

Does this answer your question?

-- 
Alexandre Fayolle
http://www.logilab.com - "Mais o� est donc Ornicar ?" - 
LOGILAB, Paris (France).


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to