python - 如何在 TraisUI 中指定 VSplit 和 HSplit 的分割比例?

标签 python traitsui

我的 View 定义如下

DefaultView = View(
    HSplit(
        Item("figure", editor=MPLFigureEditor(toolbar=True),
             show_label=False),
        VGroup(
            Item("draw_button", show_label=False)),
        show_labels=False
    ),
    width=800, height=600, title="Facial Triangles", resizable=True)

我查了HSplit的官方文档发现没有属性或方法来指定初始分流比。

有没有办法指定初始分流比?

最佳答案

来自this discussion ,我已经得到了方法:通过指定 Itemwidthheight 属性。例如,我上面的 View 已更新:

DefaultView = View(
    HSplit(
        Item("figure", editor=MPLFigureEditor(toolbar=True), width=0.95,
             show_label=False),
        VGroup(
            Item("draw_button", show_label=False)),
        show_labels=False
    ),
    width=800, height=600, title="Facial Triangles", resizable=True)

关于python - 如何在 TraisUI 中指定 VSplit 和 HSplit 的分割比例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42899365/

相关文章:

python - 为什么python setup.py安装的模块找不到安装的资源?

python - Flask 装饰器怎么会有参数?

python - 处理ValueError : cannot reindex from a duplicate axis的便捷方式

python - 检查 TreeView 的特征堆栈?

python - 在 Traitsui GUI 之外更改属性

python - 使用 fileinput 之后使用 raw_input

python - 如何在 python 的 gekko 优化器中使用数组

python-2.7 - 将成员写为 Trait 或 Trait() ex x=Str 或 x=Str() 之间的特征差异

python - TraitsUI 错误 View 取决于操作系统

python - 嵌套 HasTraits 对象的 View