[pygtk] Overriding GObject virtual methods

Christophe Dehais christophe.dehais at gmail.com
Mon Sep 22 22:13:52 WST 2008


(oops bad operations)

So say I have this C GObject (for which python bindings are provided):

typedef struct _MyObject MyObject
typedef struct _MyObjectClass MyObjectClass
struct MyObject {
    Gobject parent;
}

struct MyObjectClass {
    GObjectClass parent_class;

    void (*my_method) (void);
}

and I define this python object deriving from MyObject:

class MySubObject(module.MyObject):
   def __init__(self):
       module.MyObject.__init__(self)

How can I define the my_method() method for this derived class ? And
optionally how do I link to the parent implementation ?

Hope this is clear,

cheers,
Christophe



On Mon, Sep 22, 2008 at 4:07 PM, Christophe Dehais
<christophe.dehais at gmail.com> wrote:
> Hi everyone!
>
> pardon me if this is a silly question, but how can GObjects virtual
> methods be overriden ?
>
> Say I have this GObject:
>
> typedef struct _MyObject MyObject
> typedef struct _MyObjectClass MyObjectClass
>
> struct MyObject {
>
> }
>


More information about the pygtk mailing list