[IPython-dev] throttling widget events

Thomas Kluyver takowl at gmail.com
Fri Mar 14 13:29:31 EDT 2014


Hi Alistair,

On 14 March 2014 03:10, Alistair Miles <alimanfoo at googlemail.com> wrote:

> I've spent a couple of days working with IPython 2.0.0-b1 and am having a
> lot of fun with interact, thank you for this totally cool feature. Pretty
> much every plotting function I write now I find myself trying to find ways
> of making it interactive, just so I can play around with it :-)
>
> One thing I'm wondering, I remember from one of Brian's talks that the
> widget framework throttles the events being sent when, e.g., a slider is
> being moved, so the kernel is not totally swamped. Even still, I have some
> plotting functions I'd like to interact with which are relatively expensive
> to compute (e.g., >1s) and so I'd like to throttle the events even further.
> Is this possible, and if so is it documented anywhere?
>

Yes, you can set the w.msg_throttle parameter on your widget. It is the
number of messages that the frontend will queue for processing. The default
is 3. Turning it down will throttle more aggressively, and turning it up
will allow more traffic to be sent. I'm not sure if this is documented
anywhere, though.

For @interact, the widget object is accessible as func.widget. Or you can
use interactive() to make a widget object without displaying it. You may
also need to go into the container widget and set throttling on the
individual widgets.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140314/74045969/attachment.html>


More information about the IPython-dev mailing list