Hi,

I'm trying to debug a problem where tooltips are disappearing quickly.
It happens when I run gtk.ImageMenuItem.set_image() via a timeout
function added with gobject.timeout_add().  I'm not sure what the
problem is.  I'm hoping someone here might be able to point me to the
error of my ways or a bug report if this is simply a bug.

This has only started happening with the previous major pygtk/gtk/glib
releases.  The versions I have right now on my fedora box are:

pygtk2-2.12.0-2.fc8.i386
gtk2-2.12.8-2.fc8.i386
glib2-2.14.6-1.fc8.i386

I'll attach a small example script that exhibits the problem.  The
tooltip on the label disappears whenever the timeout function is
called.  Any hints are greatly appreciated.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I never forget a face, but in your case I'll be glad to make an
exception.
    -- Groucho Marx

#!/usr/bin/env python

import gtk
import gobject

def destroy(window):
    window.hide()
    gtk.main_quit()

def timeout(menu):
    item = menu.get_children()[0]
    item.set_image(gtk.image_new_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU))
    return True

def main():
    item = gtk.ImageMenuItem(gtk.STOCK_YES)
    menu = gtk.Menu()
    menu.append(item)

    gobject.timeout_add(1000, timeout, menu)

    window = gtk.Window(gtk.WINDOW_TOPLEVEL)
    window.connect("destroy", destroy)
    window.set_border_width(10)

    label = gtk.Label('Test')
    window.add(label)

    tooltips = gtk.Tooltips()
    tooltips.set_tip(label, 'Goes poof when item.set_image() runs', None)
    tooltips.enable()

    window.show_all()

main()
gtk.main()

Attachment: pgpBcoq9EMnX2.pgp
Description: PGP signature

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to