I've been working on a simple little PyGTK app that shows an icon in the system tray. When you right-click, the pop-up menu appears as expected. However, first the menu appears with just some up and down scroll arrows, and I have to scroll down before it fills in and shows the 3 items, and then the scroll arrows disappear.

I've searched everywhere (GTK+ API, etc.) and can't seem to find a way to disable those scroll arrows, which are clearly not needed. The relevant code snippet is below...

def _createMenu(self):
        """
        Creates the pop-up menu for the icon.
        """
        self.menu = gtk.Menu()
        quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        quit.connect("activate", self.destroy)
        about = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
        about.connect("activate", self.ShowAbout)
        configure = gtk.ImageMenuItem(gtk.STOCK_PROPERTIES)
        configure.connect("activate", self._edit_config)

        self.menu.add(about)
        self.menu.add(configure)
        self.menu.add(quit)

        self.menu.show_all()
        
    def _showMenu(self, status_icon, button, activate_time):
        self.menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, status_icon)

Further info: I'm using Python 2.52 with GTK+ 2.12.9r2 on Windoze, if that makes any difference.

TIA-- ~ewall

Funny thing, I've been using your source code for ZenTrayIcon to add audio and fix this same bug. I found a possible solution to it that I don't think will break the program.

I simply changed the below line by removing gtk.status_icon_position_menu and substituting none and now the menu pops up immediately. Haven't had any issues yet after changing it.

self.menu.popup(None, None, gtk.status_icon_position_menu, button, activate_time, status_icon)

Here is the new code.

self.menu.popup(None, None, None, button, activate_time, status_icon)

Funny thing, I've been using your source code for ZenTrayIcon to add audio and fix this same bug...

Now, that's really funny--I had forgotten all about that one! Thanks for the GTK+ tip, I can't even remember if I fixed it or not.

Oh, and to be fair, the source is almost all Todd Davis... I just added added some Windows support.

Also--you might find the Zapplet program to be a better fit--I sure have. Nate has already put in some of the framework for audio alerts and such, but didn't finish it yet. (And me, I still haven't spent enough time with GTK+ to make the GUI changes.)

This article has been dead for over six months. Start a new discussion instead.