fredrikostlund | 8 Feb 12:32
Picon

Forcing a new layout pass

Hi,

I have some problems with the layout system. Below is an example. Clicking 
the button changes the maximum value of the slider. All works fine, except 
that the new maximum label (100000) is too wide to fit in its allocated 
space. If one resizes the window a new layout pass is forced, giving the 
100000 label enough space. Is there any nice way of forcing such a update 
programmatically?

Fred

from enthought.traits.api import *
from enthought.traits.ui.api import *

class C(HasTraits):
    min_val = Int()
    max_val = Int(10)
    i = Int(0)

    b = Button('Change max')

    def _b_fired(self):
        self.max_val = 100000

    view = View(
        Item('i', editor=RangeEditor(low_name='min_val', 
high_name='max_val', mode='slider')),
        UItem('b'),
        resizable=True
    )

c = C()
c.configure_traits() 

Gmane