简体   繁体   中英

Programmatically Resize Traitsui Window

I have a traitsui gui inheriting from HasTraits (with a HSplit between a mayavi plot and a panel with editable traits). When I call .configure_traits(), the size of the resulting window seems to depend on screen size only, not on content (on OS X 10.7 and 10.8). Is there a way to make the window (in particular the panel with the editable traits) fit the size of its content?

You should include a code sample that demonstrates the issue you are seeing. TraitsUI normally generates a window that is the minimum size to contain the attributes : 例

But if you specify a size, you'll get either an absolute size:

    view = View(Item('figure', show_label=False),
                width=400, height=300, resizable=True)

or a percentage of the screen:

    view = View(Item('figure', show_label=False),
                width=.5, height=.5, resizable=True)

depending on what you asked for. What does your code say?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM