pythonenaml

Enaml: allow Window to be resizeable


If i use the Window widget, it is not resizable and fixed to its container size. How can i set the Window to be resizable? Following is not resizable:

enamldef MyWindow(Window)
    VGroup: 
        MPLCanvas:
            figure = Figure()
        CheckBox:
            text = "Show current"
        CheckBox:
            text = "Show mean"
        CheckBox:
            text = "Show first detector"

Solution

  • This works for me, I can expand the window in both directions. If you mean that you are unable to shrink the window, that because it's limited by the size of the matplotlib figure. If you want to force the figure to shrink below is natural size, you have to handle that explicitly with constraints:

    enamldef Main(Window):
        VGroup:
            MPLCanvas:
                figure = Figure()
                resist_width = 'ignore'
                resist_height = 'ignore'
                constraints = [width >= 100, height >= 100]
            CheckBox:
                text = "Show current"
            CheckBox:
                text = "Show mean"
            CheckBox:
                text = "Show first detector"