【问题标题】:Using `ipywidgets.iteract`, is it possible to locate the output beside the widgets and not below them?使用`ipywidgets.iteract`,是否可以将输出定位在小部件旁边而不是它们下方?
【发布时间】:2016-11-02 10:01:26
【问题描述】:

在 Jupyter 笔记本中使用 ipywidgets.interact 函数时,输出始终位于小部件下方。除了小部件之外是否可以显示它? 换句话说,而不是这样:

(取自this example),

我希望看到这样的东西:

【问题讨论】:

  • 我的回答对你有用吗?如果不让我知道,我可以修复。

标签: python-3.x ipython jupyter-notebook jupyter ipywidgets


【解决方案1】:

您可以使用interactive 函数以及HBox 和/或VBox 来做到这一点

this answer 为例,使用以下几行以获得所需的效果:

hb = widgets.VBox([my_plts.children[0],my_plts.children[1]])

widgets.HBox([my_plts.children[2], hb])

但是,绘图一开始并没有出现,您必须开始移动滑块才能进行渲染。至少这是我的经验。我敢肯定有办法解决它,但我懒得去调查。希望对您有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-11
    • 2022-12-03
    • 2016-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多