Alex Roitman wrote:
Tony,
On Sat, 2005-12-24 at 15:27 -0500, Tony Nelson wrote:
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)
Why would I want to do any of that, unless there's a bug in pygtk?
I think Tony's point was that Don's example probably didn't correctly
illustrate a difference in behavior between the programmatic and mouse
click actions since the event loop wasn't running.
It seems that, if I click and then click again, I should get back
to the same state as I was, and I never do. I thought initially
that some packing options are incorrect, but no amount of tweaking
packing in Dialog, its Vbox, or expander itself can seem to make
a difference.
I am not looking into making programmatic expansing/collapsing
to behave same as the UI way. Rather, I want to get the expander
to behave correctly on clicks. When the user collapses it, the
dialog window should shrink, since the whole point is to hide
the extra contents. I see no use for keeping an area of the
screen taken by "grey matter" of a dialog with no contents.
I think that your expectation is not correct - the dialog should not
shrink when the expander collapses. My observation is that windows
expand to enclose their children but they do not shrink if the
allocation requirements of the children are reduced. I expect a dialog
to behave the same. If you want to shrink the dialog I think you
probably have to catch the notify:expanded signal and then resize the
dialog programmatically using the gtk.Window.resize() method.
John
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/