At 10:12 AM -0800 3/4/06, Alex Roitman wrote:
>Content-Type: multipart/signed; micalg=pgp-sha1;
>       protocol="application/pgp-signature";
>       boundary="=-JirsYoptq0AXCyZXoyrU"
>
>On Fri, 2006-03-03 at 21:23 -0800, John Finlay wrote:
>> >>> ==============
>> >>> 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"?
>> >>>
>> >>>
>> >> I thought the message following mine actually indicated a better
>> >> solution than the one I suggested:
>> >>
>> >> http://www.daa.com.au/pipermail/pygtk/2005-December/011564.html
>> >>
>> >> i.e. use d.set_resizable(False)
>> >>
>> >
>> > This does shrink the dialog window, but then it becomes, er,
>> > not resizable :-) For a complex window with a lot of widgets
>> > and a text editable area, this is not very nice. We do want small
>> > size, but the user will ultimately decide what's the convenient
>> > size. Smallest is the nice default behavior on expander collapse.
>> >
>> What's your thinking on how this would work?
>
>My thinking is that the following should be either normal behavior
>or should be doable using signal handlers:
>
>   When the user collapses the expander widget and the space that
>   was taken up by the expander widget is no longer occupied by
>   the expander, the window shrinks to the smaller size, as small
>   as possible given the new size constraints, now that the expander
>   takes just the size of its label.
>
>In other words, I want same intuitive behavior that happens if the
>dialog were non-resizable, only I don't want it to be non-resizable.
 ...

I think that instead, the window should change size by the amount that the
Expander widget changed size, so that a shrink then expand would restore to
the size before shrinking.  This behavior and enabling it should probably
be a property of the Expander widget, which knows how much it is changing
size.
____________________________________________________________________
TonyN.:'                       <mailto:[EMAIL PROTECTED]>
      '                              <http://www.georgeanelson.com/>
_______________________________________________
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