Последовательные кнопки ipywidgets ⇐ Python
-
Anonymous
Последовательные кнопки ipywidgets
I'm trying to make a successive process of buttons clicks using ipywidgets buttons.
Click on button 1 is supposed to clear button 1 and display button 2 etc...
It looks like the introduction of the wait variable make my purge function unreachable, and I don't understand why.
from ipywidgets import Button from IPython.display import display, clear_output def purge(sender): print('purge') clear_output() wait=False for i in range(5): print(f'Button number :{i}') btn = widgets.Button(description=f'Done', disabled=False, button_style='success', icon='check') btn.on_click(purge) display(btn) wait=True while wait: pass
Источник: https://stackoverflow.com/questions/621 ... ts-buttons
I'm trying to make a successive process of buttons clicks using ipywidgets buttons.
Click on button 1 is supposed to clear button 1 and display button 2 etc...
It looks like the introduction of the wait variable make my purge function unreachable, and I don't understand why.
from ipywidgets import Button from IPython.display import display, clear_output def purge(sender): print('purge') clear_output() wait=False for i in range(5): print(f'Button number :{i}') btn = widgets.Button(description=f'Done', disabled=False, button_style='success', icon='check') btn.on_click(purge) display(btn) wait=True while wait: pass
Источник: https://stackoverflow.com/questions/621 ... ts-buttons