Jupyter Interactive Widget无法正确执行 [英] Jupyter Interactive Widget not executing properly
问题描述
我正在使用jupyte笔记本
I am using jupyte notebook
这是代码
从ipywidgets导入交互
from ipywidgets import interact
def myfunction(arg): 返回arg + 1 interact(myfunction,arg = 9);
def myfunction(arg): return arg+1 interact(myfunction, arg=9);
显示的结果是10,而应该显示一个滑块
The result showing is 10 instead it should be showing a slider
显示: 在此处输入图片描述
相反,它显示: 在此处输入图片描述
推荐答案
我无法确切说明您的操作出了什么问题,因为 您的帖子存在格式问题-您需要缩进 当您问问题以使其看起来正确时,请编码4个空格,其中 因为Python对空格敏感,所以影响了含义.
I can't tell exactly what went wrong with what you did because there are formatting issues with your post -- you need to indent the code 4 spaces when you ask the question to make it look right, which effects the meaning because Python is sensitive to white space.
我修改了您的文字并使其对我有用
I modified your text and got it to work for me
from ipywidgets import interact
def myfunction(arg):
return arg+1
interact(myfunction, arg=9)
屏幕截图:
这篇关于Jupyter Interactive Widget无法正确执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!