Creating a Custom GtkCellRenderer with PyGobject

I am currently writing a Gtk application. I still know that I am using pygtk, but since this was deprecated in favor of PyGobject, I decided to make a switch. Back in the days of pygtk, you could extend gtk.GenericCellRenderer, but this class is no longer present.

I tried to find examples in python that uses the new API, but I failed. Can someone show an example of a custom cell renderer that I could use as a starting point?

+4
source share
1 answer

Apparently, Gtk + does not have any GtkGenericCellRenderer class, is an exclusive PyGtk. Since PyGObject binding is practically no different from API C because it is an introspection technology, I suggest using the GtkCellRenderer present in Gtk +.

from gi.repository import Gtk class MyCellRenderer(Gtk.CellRenderer): def __init__(self): Gtk.CellRenderer.__init__(self) 
+1
source

Source: https://habr.com/ru/post/1398592/


All Articles