[pygtk] pygobject documentation ?
Jérôme
jerome at jolimont.fr
Thu Jan 12 04:44:38 WST 2012
Tue, 10 Jan 2012 18:54:07 +0100
Timo a écrit:
> You will notice a pattern: take the enumeration name, split the Gtk part
> and rest with a dot, then leave out GTK_*_ part from the types and
> append them to the previously splitted name.
>
> This approach always worked for me till now.
This seems to extend tu Gdk.
Besides, there's an exception when the stripped enum begins with a number, as
a python variable can't begin with a number.
http://developer.gnome.org/gdk3/stable/gdk3-Events.html#GdkEventType
typedef enum {
GDK_NOTHING = -1,
GDK_DELETE = 0,
GDK_DESTROY = 1,
GDK_EXPOSE = 2,
GDK_MOTION_NOTIFY = 3,
GDK_BUTTON_PRESS = 4,
GDK_2BUTTON_PRESS = 5,
GDK_3BUTTON_PRESS = 6,
[...]
} GdkEventType;
becomes
/usr/share/pyshared/gi/overrides/Gdk.py
class Event(Gdk.Event):
_UNION_MEMBERS = {
Gdk.EventType.DELETE: 'any',
Gdk.EventType.DESTROY: 'any',
Gdk.EventType.EXPOSE: 'expose',
Gdk.EventType.MOTION_NOTIFY: 'motion',
Gdk.EventType.BUTTON_PRESS: 'button',
Gdk.EventType._2BUTTON_PRESS: 'button', <-- see the _
Gdk.EventType._3BUTTON_PRESS: 'button', <-- see the _
[...]
}
I had a hard type figuring that one out...
--
Jérôme
More information about the pygtk
mailing list