[pygtk] Re: Overriding GObject methods in Python
hrvoje.niksic at avl.com
Fri Nov 24 22:42:02 WST 2006
On Fri, 2006-11-24 at 15:22 +0100, Gustavo J. A. M. Carneiro wrote:
> The GenericGtkFooBar are the old way of doing this and are
> Nowadays you can subclass any gtk.XxxCellRenderer and override
I understand that, but I'm referring to the way that this is
implemented: PyGTK still has to provide C code for each Gtk* class that
has virtual methods that need to be overridable from Python.
Ideally I'd like to provide a way for Python to override members of
GObject classes I define without writing new C code for each class. The
C code would definitely have to be written, but it could be written only
once and work for all classes written to conform to that kind of
> Take a look at (define-virtual ...) blocks in the .defs.
I assume you're referring to (for example) this:
How does such a definition enable one to subclass GtkCellRenderer from
Python? Even with the information above, the "render" function pointer
is still a member of the class struct, and as such inaccessible from
Python. Python code that knows its GObject class and the name of the
method should be able to influence the ->render field of the subclass it
Am I missing something that could enable this to work?
More information about the pygtk