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.

2
  • 2
    this could be useful : gist.github.com/andialbrecht/4463278 (simple googling) Commented Sep 16, 2015 at 14:51
  • @Hacketo: Thanks, I could solve my problem using your link. You could post it as an answer if you like. Commented Sep 16, 2015 at 15:13

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.