Implementing GObject interfaces in Python
Asked Answered
L

1

4

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.

Llovera answered 16/9, 2015 at 14:42 Comment(2)
this could be useful : gist.github.com/andialbrecht/4463278 (simple googling)Thi
@Hacketo: Thanks, I could solve my problem using your link. You could post it as an answer if you like.Llovera
L
1

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.

Llovera answered 16/9, 2015 at 14:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.