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 w
import time
import 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 jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CANWNHraxk%2BCAsCRnJHu6uyfKx9rttLjg%2BruZUE8ieR%2BTggHsKg%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
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.
----Travis DePrato (he/him/his, they/them/theirs)University of Michigan, Ann ArborComputer Science & EngineeringMathematics (Discrete and Algorithmic Methods)
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 jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CANWNHraxk%2BCAsCRnJHu6uyfKx9rttLjg%2BruZUE8ieR%2BTggHsKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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 jupyter+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAPDWZHzvL8tiz%2BVPGuBTOgduJdjG5juZ9PUeT5HA3e%2BD1DxAyQ%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
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.
----Travis DePrato (he/him/his, they/them/theirs)University of Michigan, Ann ArborComputer Science & EngineeringMathematics (Discrete and Algorithmic Methods)
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 jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CANWNHraxk%2BCAsCRnJHu6uyfKx9rttLjg%2BruZUE8ieR%2BTggHsKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
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 jupyter+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAPDWZHzvL8tiz%2BVPGuBTOgduJdjG5juZ9PUeT5HA3e%2BD1DxAyQ%40mail.gmail.com.
--Damián Avila