How do I change a button label created with 'interact_manual' from 'ipywidgets'? and how do I change the size and colour of that button?
Here is what I wrote
from ipywidgets import interact,interact_manual
def HDI_vs_CrimeRate():
#do some thing here
interact_manual(HDI_vs_CrimeRate)
and here is how the button looks like: 1 Thanks for your help
ipywidgets, also known as jupyter-widgets or simply widgets, are interactive HTML widgets for Jupyter notebooks and the IPython kernel. Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data. Learning becomes an immersive, fun experience.
The interact function ( ipywidgets. interact ) automatically creates user interface (UI) controls for exploring code and data interactively. It is the easiest way to get started using IPython's widgets.
You may need to upgrade your ipywidgets; for me, your code returns a button with the label 'Run Interact', which is a little better than yours but not yet what you want.
Assign your interact_manual to a variable, alter the description text of the child widget, and then call display() on your interact. This seems to get the job done, although there may be a more elegant way.
from ipywidgets import interact, interact_manual
def HDI_vs_CrimeRate():
#do some thing here
im = interact_manual(HDI_vs_CrimeRate)
im.widget.children[0].description = 'changed'
display(im)
Edit: For color, you can use im.widget.children[0].style.button_color = 'red'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With