gtk treeview: place image buttons on rows

前端 未结 3 1826
一个人的身影
一个人的身影 2020-12-19 08:47

For each row in my treeview, I want 4 image buttons next to each other. They will act like radio buttons, with only one being activateable at a time. Each button has an \'on

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-19 09:42

    Here is a short version without kiwi requirement.

    class CellRendererClickablePixbuf(gtk.CellRendererPixbuf):
    
        __gsignals__ = {'clicked': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                                    (gobject.TYPE_STRING,))
                       }
    
        def __init__(self):
            gtk.CellRendererPixbuf.__init__(self)
            self.set_property('mode', gtk.CELL_RENDERER_MODE_ACTIVATABLE)
    
        def do_activate(self, event, widget, path, background_area, cell_area,
                        flags):
            self.emit('clicked', path)
    

提交回复
热议问题