1
 2
 3
 4
 5
 6
 7
 8
 9
10
from IPython.display import display
import ipywidgets as widgets


def clicked(arg):
    print("button has been clicked!")

button_download = widgets.Button(description = 'Test Button')   
button_download.on_click(clicked)
display(button_download)

Reference

1、https://stackoverflow.com/questions/58716248/how-to-create-a-simple-button-with-output-in-a-python-jupyter-notebook

打赏

微信 微信 支付宝 支付宝
万分感谢