Resizing MainWindow, HGroup doesn't expand verticallly

149 Views Asked by At

The following simple layout doesn't expand vertically after resizing, only vertically. I already played around with hug_width, hug_height and partners without success. I also tried using constraints with hbox

What i am missing?

from enaml.widgets.api import MPLCanvas, MainWindow, HGroup, VGroup, CheckBox
enamldef PumpProbeViewer(MainWindow):
    HGroup:
        align_widths = False
        MPLCanvas: plot_wid:
            figure = Figure()
        VGroup: control:
            CheckBox:
                text = "Show current"
            CheckBox:
                text = "Show mean"
            CheckBox:
                text = "Show first detector"
1

There are 1 best solutions below

0
On BEST ANSWER

The vertical size is limited by the VGroup since check boxes cannot expand vertically. You need to add a trailing spacer to the VGroup so that it can expand:

enamldef Main(Window):
    HGroup:
        align_widths = False
        MPLCanvas:
            figure = Figure()
        VGroup:
            padding = 0
            trailing_spacer = spacer
            CheckBox:
                text = 'foo'
            CheckBox:
                text = 'bar'
            CheckBox:
                text = 'baz'

However, this type of layout can be easily achieved with a single Container. There's no need for nesting:

enamldef Main(Window):
    Container:
        constraints = [
            hbox(mpl, vbox(cb1, cb2, cb3, spacer))
        ]
        MPLCanvas: mpl:
            figure = Figure()
        CheckBox: cb1:
            text = 'foo'
        CheckBox: cb2:
            text = 'bar'
        CheckBox: cb3:
            text = 'baz'

You may also consider visiting the Enaml group for these types of questions: https://groups.google.com/forum/#!forum/enaml