Opened 13 years ago

Last modified 4 years ago

#3836 new enhancement

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

Reported by: was Owned by: itolkov
Priority: major Milestone: sage-6.4
Component: interact Keywords:
Cc: timdumol, mpatel, jason 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 13 years ago by TimothyClemans

  • Component changed from notebook to interact
  • Owner changed from boothby to itolkov

comment:2 Changed 12 years ago by kcrisman

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 12 years ago by timdumol

  • Cc timdumol mpatel added

comment:4 Changed 9 years ago by kcrisman

  • Cc jason added
  • Report Upstream set to 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 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:6 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:7 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:8 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:9 Changed 4 years ago by jdemeyer

This can be done in Jupyter, using traitlets links.

Note: See TracTickets for help on using tickets.