In [1]:
import time
import IPython
import ipywidgets

import context

import gopro_helper.task as task

In [ ]:


In [19]:
class Example(task.Task):
    """Simple example of a work task running in a background thread.
    """
    def __init__(self, label='', *args, **kwargs):
        self.label = label
        self.max = 10
        super().__init__(interval=0.01, *args, **kwargs)
        
    def initialize(self, ):
        self.widget = ipywidgets.FloatSlider(min=0, max=self.max, description=self.label)
        IPython.display.display(self.widget)

    def update(self):
        self.widget.value = round(time.time() % self.max, 2)

    def finish(self):
        self.widget.close()

    def special_update_max(self, max_new):
        with self.lock:
            self.max = max_new
            self.widget.max = max_new

In [ ]:


In [20]:
e = Example(label='Seconds', auto_start=True)



In [23]:
e.special_update_max(5)

In [24]:
e.stop()

In [ ]: