[pygtk] Change the icontheme

Timo timomlists at gmail.com
Tue Jul 21 17:00:03 WST 2009


I want the users of my program to be able to change the default 
icontheme into an other iconset.

How is this done the best?

I have the following code that changes the icons into my custom icons, 
but how to set them back?


    def change_clicked(self, widget):
        self.register_iconsets([('gtk-apply', 'icon_apply.png'),
                                            ('gtk-cancel', 
'icon_cancel.png')])

        self.window.queue_draw()

    def register_iconsets(self, icon_info):
        iconfactory = gtk.IconFactory()
        stock_ids = gtk.stock_list_ids()
        for stock_id, image in icon_info:
            pixbuf = gtk.gdk.pixbuf_new_from_file(image)
            iconset = gtk.IconSet(pixbuf)
            iconfactory.add(stock_id, iconset)
        iconfactory.add_default()


More information about the pygtk mailing list