How to get the output of the function executed on_click
by ipywidgets.Button
outside the function to use in next steps? For example, I want to get back the value of a
after every click to use in the next cell of the jupyter-notebook. So far I only get None
.
from ipywidgets import Button
def add_num(ex):
a = b+1
print('a = ', a)
return a
b = 1
buttons = Button(description="Load/reload file list")
a = buttons.on_click(add_num)
display(buttons)
print(a)