我试着做下一个例子。我的问题是,当我按下一个按钮时,我需要回到“索引”功能,这样我就可以继续我正在做的事情(在下一行,我不想再从头开始),然后输入一个条件:如果继续。单击(单击)。按了一个按钮,我怎么能回到我离开的地方?在
import IPython.display
import ipywidgets
import ipywidgets as widgets
def clicked(option):
if option.description == "continue":
print ('continue')
return ('continue')
elif option.description == "finish":
print('finishhh')
return ('finishhh')
def index():
print ('hello')
continues = ipywidgets.Button()
finish = ipywidgets.Button()
continues.description = "continue"
finish.description = "finish"
display(continues, finish)
continues.on_click(clicked)
finish.on_click(clicked)
if continues.on_click(clicked) == "continue":
print('here!')
elif finish.on_click(clicked) == "finish":
print('here2')
index()
谢谢。在
目前没有回答
相关问题 更多 >
编程相关推荐