Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enaml: allow Window to be resizeable

Tags:

python

enaml

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"
like image 741
tillsten Avatar asked Feb 28 '26 20:02

tillsten


1 Answers

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"
like image 65
Chris Colbert Avatar answered Mar 02 '26 08:03

Chris Colbert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!