Hello,

I'm trying to implement a container in python.

I have something like this:

class Cont(clutter.Actor, clutter.Container):

    __gtype_name__ = 'Cont'

    def __init__(self):
        clutter.Actor.__init__(self)
        clutter.Container.__init__(self)


    def do_add(self, child):
        clutter.Container.do_add(self, child)

    def do_remove(self, child):
        clutter.Container.do_remove(child)

If try to build such a class I get the following error:

   clutter.Container.__init__(self)
NotImplementedError: Cont can not be constructed

I tried to provide some dummy method for the container, but this seems
useless, since Container provides default implementations.

I also tried to not call the __init__ method of container, which seems
logical, since it's an interface. However, I get the following error when I
call do_add:.

 Warning: g_type_interface_peek: assertion `instance_class != NULL' failed
  clutter.Container.do_add(self, child)

This sounds like something is not initialized, but what ?

So, what is the regular way to implement an interface ?

Thanks,

Julien

Reply via email to