Hello, I have asked this question before: http://www.daa.com.au/pipermail/pygtk/2005-December/011572.html and was pointed by John Finlay to the proper solution: http://www.daa.com.au/pipermail/pygtk/2005-December/011562.html
Unfortunately, following the given advice still did not do the trick.
Running the code below still leaves the window not shrunken in
either direction. It seems to be limited by the size that would
be a minimum size of the _expanded_ expander, not collapsed expander.
==============
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 that is very very very long\n'
'and another line'))
def expander_toggled(expander,param):
if expander.get_expanded():
print "expanding -> do nothing"
else:
print "collapsing -> shrink both X and Y size"
d.resize(1,1)
e.connect('notify::expanded',expander_toggled)
d.vbox.add(e)
d.show_all()
gtk.main()
==============
If after
print "expanding -> do nothing"
I add:
d.resize(400,200)
or if I resize the window manually to a larger size
while expander is in the expanded state, I can see that
the window does indeed shrink somewhat upon collapsing
the expander, so I know that resize() is working.
The problem is that it shrinks to the size constrained
by _expanded_ state of the expander, not its _collapsed_
state.
After collapsing, I can manually resize the window
to the smaller size, picking up "the slack" produced
by collapsing the expander.
Am I missing something obvious? How can I make the window
shrink after expander is collapsed so that there's
no "slack"?
Thanks in advance for any insights,
Alex
--
Alexander Roitman http://www.gramps-project.org
signature.asc
Description: This is a digitally signed message part
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
