gpt4 book ai didi

python - 木星,属性错误: type object 'Widget' has no attribute 'observe'

转载 作者:行者123 更新时间:2023-12-05 05:22:38 33 4
gpt4 key购买 nike

我尝试对我的 toggleButton 使用 observe

wtarget = widgets.ToggleButtons(
description='select target',
options=['A', 'B', 'C', 'D', 'E', 'F'])
wtarget.observe(target_on_value_change, names='value')

它显示了这个错误:

AttributeError: 'ToggleButtons' object has no attribute 'observe'

我在另一台 MacBook 上没有问题,但是这台却出现了问题。我正在使用 MacBook,10.12。 Python 版本 4.0.0。 ipywidgets 是通过 pip 安装的。

谢谢。

最佳答案

这表明你有一个旧版本的 traitlets。 .observe 被添加到 traitlets 4.1 中:

pip install --upgrade traitlets

您可能想要升级更多:

pip install --upgrade ipywidgets

关于python - 木星,属性错误: type object 'Widget' has no attribute 'observe' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39815515/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com