you can try this

# 1st cell
import ipywidgets

fslider = ipywidgets.FloatSlider(max=10, min=0)
fslider

# 2nd cell
import time

for i in range(8):
    fslider.value = i
    time.sleep(0.2)


Hai

On Wed, Jul 13, 2016 at 9:40 AM, Attila Bagoly <[email protected]>
wrote:

> Hi!
>
> I'm working on interactive interface (using ipywidgets) for a machine
> learning library in jupyter. I have a function with a big loop (training
> loop) which blocks the main thread (I can't put this loop to a different
> thread) and therefore I can't interact with server during the training.
>
>
> I made a simple example:
>
> from time import sleep
> from ipywidgets import widgets
> from IPython.display import display
>
>
> fs = widgets.FloatSlider(max=100, value=0)
> display(fs)
> for i in range(10):
>     display(fs.value)
>     sleep(1)
>
> Here I won't see the change in fs.value until the loop ended. How can I
> force IPython to synchronize the fs.value in every iteration?
>
> Attila
>
> --
> 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/f0b55a1c-7127-479d-804c-48c041d29b24%40googlegroups.com
> <https://groups.google.com/d/msgid/jupyter/f0b55a1c-7127-479d-804c-48c041d29b24%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [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/CAFNMPM-wUncn0CQwHARMNCZaFjezAdOQP%3DkS_1z%3D4JYE24AO-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to