jupyter ipywidgets 不显示函数 return 值

jupyter ipywidgets doesn't show function return value

我用了最简单的例子:

from ipywidgets import interact, widgets
from IPython.display import display


# this is a sample function
def myfunc(x):
    display(x*2) # I add this for testing
    print(x*2)  # I add this for testing
    return x*2

interact(myfunc,x=widgets.IntSlider(min=-10,max=10,value=0))

滑动滑块时,无输出。

但是 here 中的相同示例确实显示了输出:

如何修复 jupyter 以显示输出?

刚发现这是由 Limit Output 扩展

引起的

参数:

虽然限制字符数是:100000,仍然影响ipywidgets。

禁用此解决方法: