Ask Your Question

is it possible for dynamic update the input_box in @interact part?

asked 2016-05-28 19:04:33 +0200

sensen gravatar image

still new to Sage. followed the pre_tutorials and online ingteract wiki examples.

try to realize the function code like bellow. given the relationship between V and P is V=P+107, and two input_box are defined.

@interact def _(P=input_box(20, width=6, label="power(dBm)"),V=input_box(127, width=6, label="voltage(dBuV)")): V=P+107

want to realize when I input the new number to the input_box of P, then the input_box of V will dynamically update the value base on the relationship of V=P+107. and vice versa

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-28 23:50:19 +0200

You can certainly nest interacts so that the first input modifies the second:

def _(P=input_box(20, width=6, label="power(dBm)")):
    def _(V=input_box(P+107, width=6, label="voltage(dBuV)")):

Example output here. I don't think the vice versa part is currently possible.

edit flag offensive delete link more


sorry for the late reply. I checked the documents again. didn't find the method to update the value of the input_box. so maybe this way is not possible. To make the convert function simple and logical. maybe using one input_box, one result area, and with two button. the two button control the convert logic and show the result explanation text.

sensen gravatar imagesensen ( 2016-05-29 19:20:43 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-05-28 19:04:33 +0200

Seen: 174 times

Last updated: May 28 '16