At 12:31 PM -0700 12/24/05, Don Allingham wrote:

>Hello, and happy holidays to everybody.
>
>I am observing strange packing behavior of the Expander
>widget. Consider the following piece of code:
>===========
>import gtk
>
>d = gtk.Dialog('Dialog')
>d.connect('delete-event',lambda obj,event: gtk.main_quit())
>
>e = gtk.Expander('Expander')
>e.add(gtk.Label('Label\nAnother line\nand another line'))
>
>d.vbox.add(e)
>d.show_all()
>
>e.set_expanded(True)
>e.set_expanded(False)
>
>gtk.main()
>===========
>
>When expander is expanded and then collapsed programmatically,
>the whole window is collapsed. But if I click to expand the
>expander and then click to collapse it, the window stays
>expanded.
>
>Do I have to do some more packing magic (how?) or
>is this bug in pygtk?

I would think this is because you did this before the widgets received
their allocations, which happens at event processing time (I think you can
see this by connecting to the "size_allocate" gtk.Widget signal).  You
might want to set the expanded state in response to some signal or other
(maybe "size_allocate"), or you might see what happens if you have an event
eater before you do this.  (I'm a bit uncomfortable with event eaters in
general, and especially before calling gtk.main(), so it's at your own
risk.)

def gtkeat():
    while gtk.events_pending():
        gtk.main_iteration(False)
____________________________________________________________________
TonyN.:'                       <mailto:[EMAIL PROTECTED]>
      '                              <http://www.georgeanelson.com/>
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to