smheidrich
smheidrich

Reputation: 4539

Implementing GObject interfaces in Python

When using the Python 3 bindings of GTK3, is it possible to implement gobject.GInterface interfaces by subclassing them?

In my specific case, I want to write a custom Gtk.TreeModel implementation. Is it sufficient to just subclass it and implement all virtual methods (do_*)? In my constructor, do I call the parent constructor via super().__init__() as usual? Is there anything else I need to consider? Or can I only implement interfaces in GTK's native C?

I'm getting various errors and it would help me to know whether the impossibility of doing this in Python in the first place could be a cause.

Upvotes: 4

Views: 654

Answers (1)

smheidrich
smheidrich

Reputation: 4539

Because it answered my question, I'm posting Hacketo's answer as per the commonly accepted guideline for questions answered in comments.

Implementing gobject interfaces in Python does seem possible and an example specifically for Gtk.TreeModel can be found here.

Upvotes: 1

Related Questions