[pygtk] Gnome panel applet troubles

Leon Bogaert leon at tim-online.nl
Mon Nov 29 06:36:04 WST 2010


OK, I found it: I had to use this fix:
applet.set_background_widget(applet)

and my applet extended the gnomeapplet.Applet class. After removing that it worked!

Regards,
Leon

________________________________________
From: Leon Bogaert
Sent: Saturday, November 27, 2010 19:51
To: pygtk at daa.com.au
Subject: Gnome panel applet troubles

Hi all,

I'm having some troubles with how my gnome panel looks. I've attached some screenshots so you can see what I mean.
The left applet is the "hamster applet" for time tracking. The applet on the right is my applet.

As you can see in the first screenshot (Screenshot-3.png) the background of my applet is weird. The lower half is another color than the top part.
If I hover over my applet (Screenshot-5.png) the background turns bright. The hamster applet doesn't have that.

And it's even weirder when I put a label in it. Then the color of the font in the label is very dark so it's almost unreadable.

What could I be doing wrong? I don't get it.

My Applet init method:

    def __init__(self, applet, iid):
        logging.debug('__init__')

        # save the applet object
        self.applet = applet

        # determine the size to draw the icon
        size = self.applet.get_size() - 2

        #Get theme, find SVG icon and put it in a pixbuf
        theme = gtk.icon_theme_get_default()
        pixbuf = theme.load_icon(self.icon_name, size, gtk.ICON_LOOKUP_FORCE_SVG)

        #Load image
        image = gtk.image_new_from_pixbuf(pixbuf)

        # set up the applet tooltip
        self.applet.set_tooltip_text(self.title)

        self.button = gtk.Button()
        self.button.set_relief(gtk.RELIEF_NONE)
        self.button.set_image(image)

        self.button.connect('button-press-event', self.button_press)

        self.applet.add(self.button)
        self.applet.show_all()

Thanks in advance!

Regards,
Leon


More information about the pygtk mailing list