I have a simple question. I am using Jupyter Notebook (with Python) and I 
would like simply creates a button that could pause some code. Something 
like if the button is pressed continue to run a for loop, if not then stop.

I tried with the following simple code but when I click on the toggle 
button there is no effect on the value. Actually if it could work even 
between twi Jupyter cells it would be the best. Can you help me?



import ipywidgets as wimport timeimport threading


toggle = w.ToggleButton(description='click here')
display (toggle)

def worker():
       print(toggle.value)


for i in range(5):
    t = threading.Thread(target=worker)
    time.sleep(1)
    t.start()

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/fd9231a4-6e93-4851-8630-0266a60ca194%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to