Clear output widget using onclick Button event - Python
问题 I am working on a Jupyter Notebook in which I am using a button created with ipywidgets to display a df when clicking on it. For this I am using the following code: import ipywidgets as widgets import numpy as np vartest = 0 Button = widgets.Button(description='Search', disabled=False, button_style='info', tooltip='Search') display(Button) def whenclick2(b): global df if vartest==0: df = pd.DataFrame(np.arange(5)) class displayDF(object): def _create_widgets(self): self.button = Button self