interact and auto-update

25 views
Skip to first unread message

john_perry_usm

unread,
Jan 26, 2009, 4:51:20 PM1/26/09
to sage-devel
Hi,

At SD12 I brought up (again) the question of auto-updating interact
worksheets. To review the problem: if an interact engages in a lot of
computation, and the moves a slider, then the interact gets kind of
ugly. This can be especially bad if a lot of students are using the
same server.

It occurred to me that there is a (relatively) simple workaround. I
can add a checkbox widget in the code labeled "Auto update?" By
default, it is on. For an interact that engages in a lot of
computations, The user can click the checkbox to turn it off, move the
sliders, then click the auto update button on again, and now it
updates.

I'll post this to sage-support too, but I'm writing it here to ask
whether people think that this should be a *default* widget that is
included with *every* Sage interact. It's not a great solution, but it
could be a start...?

regards
john perry

Mike Hansen

unread,
Jan 26, 2009, 4:57:38 PM1/26/09
to sage-...@googlegroups.com
Hello,

On Mon, Jan 26, 2009 at 1:51 PM, john_perry_usm <john....@usm.edu> wrote:
> I'll post this to sage-support too, but I'm writing it here to ask
> whether people think that this should be a *default* widget that is
> included with *every* Sage interact. It's not a great solution, but it
> could be a start...?

How about having it so that if you have interact_update=False in the
parameter list, then things won't automatically update when the
controls are changed. Instead, there'd just be a button labeled
"Update" that appears which will rerun the function when it is
clicked?

--Mike

William Stein

unread,
Jan 26, 2009, 5:43:23 PM1/26/09
to sage-...@googlegroups.com

That's an excellent idea, and probably very easy to implement too.

William

Jason Grout

unread,
Jan 26, 2009, 6:01:02 PM1/26/09
to sage-...@googlegroups.com


How about this slight change in syntax:

@interact(update=False)
def _(...


Jason

Mike Hansen

unread,
Jan 26, 2009, 6:23:02 PM1/26/09
to sage-...@googlegroups.com
On Mon, Jan 26, 2009 at 3:01 PM, Jason Grout
<jason...@creativetrax.com> wrote:
> How about this slight change in syntax:
>
> @interact(update=False)
> def _(...

If you wanted to do this, and still support the regular @interact
(with no parens) syntax, then you'll need to make a pretty
awkward/convoluted construction in order support both.

As the functions parameters already affect how interact works, I don't
think an interact_update=False would be that surprising.

--Mike

kcrisman

unread,
Jan 26, 2009, 8:22:48 PM1/26/09
to sage-devel
Particularly for heavy use or ones with a fair amount of symbolic
usage I think this is a great idea. If it's not actually a little
checkbox but rather a function parameter, though, it should be quite
clear in the interact? documentation (and fairly early on) what to do,
and probably include a couple typical examples where this might be
useful (which John or I could probably readily give you!).

- kcrisman

William Stein

unread,
Jan 27, 2009, 1:52:58 AM1/27/09
to sage-...@googlegroups.com, Igor Tolkov

+1 to this; Mike speaks from having a very strong sense for how decorators
work in Python.

Personally, I would prefer update=False. It would be easier to
remember than interact_update, which is rather long.

By the way, it's about time figure out how to specify more precisely
layout information for controls. Any proposals for the syntax for
this. I've cc'd Igor Tolkov, who once suggested something to me last
summer (he did a Google-funded project on @interact last summer --
thanks Google!).

William

john_perry_usm

unread,
Jan 27, 2009, 1:37:10 PM1/27/09
to sage-devel
I agree with Mike and William.

john perry

On Jan 27, 12:52 am, William Stein <wst...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages