I updated the code (same link) to have dynamic resize (tested with
label). I used more or less the same algorithm as you where sizing is
down from top to bottom and "resizing" is done from bottom to top.

Is your kytten-gui code available somewhere ?

Nicolas


On Jun 6, 5:27 pm, Lynx <[email protected]> wrote:
> On Jun 6, 5:50 am, Nicolas Rougier <[email protected]> wrote:
>
> > Well, I think it should be straightforward to make it dynamic...
>
> Here's how I implemented it:
>
> Sizing:
> 1. Dialog calls its child layout to calculate its required size
> 2. Layouts call their children to calculate their required size
> 3. This continues down until we hit a basic element, like a Text or
> Button that knows how to calculate its minimum required size
> 4. Layouts then calculate their size by adding up the sizes of their
> children
> 5. Dialog now knows its minimum size
>
> Layout:
> 1. Dialog calculates its new position on the screen, i.e. centered,
> aligned with top right, etc. (plus an offset if given)
> 2. Dialog informs its child of its new location
> 3. Layouts inform their children of their new locations, i.e.
> VerticalLayout calculates top left, assigns first child to that, then
> continues down from there
>
> Expansion:
> 3a. Layouts with expandable children will tell those children to
> expand to the maximum width (or height, in HorizontalLayout), which is
> the width of the widest child in the layout
> 3b. Layouts which are expandable (one or several of their children are
> expandable) will split the newly available space between their
> expandable children
> 3c. Spacers, the default expandable children, simply expand to fill
> whatever space is available.
>
> The expansion step actually happens as part of layout step 3.
>
> Here's a sample screenshot:
>
> http://lagkitten.purrsia.com/kytten-gui-3.jpg
>
> I proceed from top down since the Dialog is the dispatcher for events
> anyway, so is best positioned to start the ball rolling.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to