Skip to content

Instantly share code, notes, and snippets.

@Breta01
Created February 23, 2017 19:49
Show Gist options
  • Save Breta01/3fec2b440ee7380501ff5cc518a601ec to your computer and use it in GitHub Desktop.
Save Breta01/3fec2b440ee7380501ff5cc518a601ec to your computer and use it in GitHub Desktop.
Handling click on button widget
from IPython.display import display, clear_output
# Creating and Displaying button
button = widgets.Button(description="Button Text!")
display(button)
# Callback function with button parameter
def clicked(b):
clear_output()
print("Result of button click: ")
# Defining callback function
button.on_click(clicked)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment