[pygtk] Problem with Notebook
Frédéric
frederic.mantegazza at gbiloba.org
Thu Dec 25 18:42:07 WST 2008
On mercredi 24 décembre 2008, John Finlay wrote:
> I don't see how that would happen. I guess a small self-contained
> example would illustrate the problem.
Here is a little example...
I block switching to the Page 2, with your trick. The first time you select
that page, the callback is called, but the page is not displayed. Good.
But then, if you click again on that page, the callback is not called
anymore, until you switch to another page first (or just click on the
current selected one). It acts like if this page was selected, but not
displayed. Also note that if you click the currnt page again, the callback
is not called neither. But is change internal stuff, as it calls the
callback when clicking on Page 2!
Sounds like a bug to me...
------------------------------------------------------------------------
import pygtk
pygtk.require("2.0")
import gtk
# Callback
def switchPage(widget, page, page_num):
print "Page %d selected" % (page_num + 1)
if page_num == 1:
notebook.stop_emission('switch-page')
# Create widgets
win = gtk.Window()
notebook = gtk.Notebook()
notebook.append_page(gtk.Label("Page 1"))
notebook.append_page(gtk.Label("Page 2"))
notebook.append_page(gtk.Label("Page 3"))
win.add(notebook)
win.show_all()
# Connect signals
win.connect('destroy', gtk.main_quit)
notebook.connect('switch-page', switchPage)
gtk.main()
------------------------------------------------------------------------
--
Frédéric
http://www.gbiloba.org
More information about the pygtk
mailing list