简体   繁体   English

以编程方式调整Traitsui窗口的大小

[英]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). 我有一个从HasTraits继承的traitsui gui(在mayavi图和具有可编辑特征的面板之间具有HSplit)。 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). 当我调用.configure_traits()时,结果窗口的大小似乎仅取决于屏幕大小,而不取决于内容(在OS X 10.7和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 : TraitsUI通常会生成一个窗口,该窗口的最小大小应包含以下属性 例

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? 您的代码怎么说?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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