-
Notifications
You must be signed in to change notification settings - Fork 76
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
Saving the state of a variable for use outside of widget doesn't seem to work #393
Comments
In this case you'll need to use the global keyword I believe (search for Julia soft global scope). Generally, you should put the code that uses the variables inside of the manipulate block if possible. :) |
Thanks for your answer! Here's the code I'm using :
I want to use the values of mu and the choice of solver in the next block :
I looked up (and tried) to use soft global scopes, but I'm not sure how it applies to Jupyter, since from my understanding all the blocks of the given jupyter notebook behave as a single module, no? Thanks again, it's very much appreciated! :) |
Finally found the fix, which is quite dumb, but in case someone else stumbles upon this one day, simply using global outside and inside the @manipulate did the trick! For example :
Will return the last value of \mu, even if it's in another cell of the Jupyter notebook! |
Hi! If this is the wrong place to ask, I'll be happy to move my issue/question to where it's better suited if you could point me in the right direction!
I'm very much new to Julia and using Interact to make a neat little interface in Jupyter (using Julia 1.5.3), but I'd like to be able to save the state of different variables (sliders and dicts), in another cell of the jupyter notebook, how can I go around saving the state of the selected variable?
I tried creating the variable outside of the
@manipulate
macro, and saving the state this way, but it doesn't change the value of the outside variable, for example :valstate = 0
@manipulate for state=1:1:10
valstate = state
end
print(valstate)
Will return 0, how can I make it return the single value between 1 and 10 that was the last state of the slider?
Thanks a lot!
The text was updated successfully, but these errors were encountered: