Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
williamstein opened this issue Aug 13, 2008 · 3 comments
Open

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

williamstein opened this issue Aug 13, 2008 · 3 comments

Comments

@williamstein
Copy link
Contributor


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?

CC: @TimDumol @qed777 @jasongrout

Component: interact

Issue created by migration from https://trac.sagemath.org/ticket/3836

@kcrisman
Copy link
Member

comment:2

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...

@kcrisman
Copy link
Member

comment:4

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.

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@jdemeyer
Copy link

comment:9

This can be done in Jupyter, using traitlets links.

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants