Opened 14 years ago

Last modified 6 years ago

#3836 new enhancement

notebook interact -- make it so one control can depend on others

Reported by: William Stein Owned by: Igor Tolkov
Priority: major Milestone: sage-6.4
Component: interact Keywords:
Cc: Tim Dumol, Mitesh Patel, Jason Grout Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

I really like the @interact functionality! I'm trying to do something
like this:

@interact
def _(p=5,q=range(p)):
   ...

So I'd like the range of q to depend on the current value of p. This
doesn't seem to be possible. Is there any way to make it work?

Change History (9)

comment:1 Changed 14 years ago by Timothy Clemans

Component: notebookinteract
Owner: changed from Kelly Boothby to Igor Tolkov

comment:2 Changed 13 years ago by Karl-Dieter Crisman

Here is another request from sage-support which seems very similar.

I want to know if there is any way to "create" new buttons while already in execution.

This is a testing code i wrote (of course, just for testing purposes :P)

@interact 
def _(n1=input_box(0,label='Testing', type=int),a=selector([1,2,7], 
buttons=True), n2=input_box(1,label='Testing2',type=int), 
juega=input_box(0,label='Testing3',type=int)): 
    if(n1>0): 
        print 'hi' 
        another_function() 
def another_function(t1=input_box(0,label='Testing123')): 
    print 'hola' 

Thing is, when i run it, i can get it to print 'Hola' but no input_box is created again. I've managed to "make" one using html, but i can't get to "interact" with it.

What i'm thinking on doing is a program that has several options using a selector, e.g. if you choose 1 then it should appear a grid so that when u enter matrix values it does some calcs, if you choose 2 then it should appear an input box, and so on...

comment:3 Changed 13 years ago by Tim Dumol

Cc: Tim Dumol Mitesh Patel added

comment:4 Changed 11 years ago by Karl-Dieter Crisman

Cc: Jason Grout added
Report Upstream: N/A

Turns out that this is going to be available once it makes its way back from the single-cell server code! See this ask.sagemath.org question, in particular Jason's answer.

comment:5 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11sage-5.12

comment:6 Changed 9 years ago by For batch modifications

Milestone: sage-6.1sage-6.2

comment:7 Changed 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:8 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4

comment:9 Changed 6 years ago by Jeroen Demeyer

This can be done in Jupyter, using traitlets links.

Note: See TracTickets for help on using tickets.