Message Boards Message Boards

0
|
12665 Views
|
6 Replies
|
1 Total Likes
View groups...
Share
Share this post:

How to programmatically paste snapshot of a Manipulate?

If I have AppearanceElements->"SnapshotButton" in a Manipulate[], and then click that button, it generates a nice snapshot of the code for the default parameters.

Is there a way to get that output programmatically, for an arbitrary Manipulate[] as an input?
POSTED BY: Philip Maymin
6 Replies
What do you have in mind? Would you have some code in another cell so when you run it it finds that Manipulate cell and returns a snapshot code? Or would you rather wrap interactive Manipulate interface inside some code to do that?

BTW, maybe a starting point, if you change parameters of an interface and apply InputForm to it it will return you something close. Snapshot returns DynamicModule, and InoutForm will return still Manipulate but with parameters initialized at current values.

POSTED BY: Sam Carrettie
The InputForm is a neat idea! I'm not able to do it to a variable however, only if I type it after the output box itself. Also, it, as you point out, keeps it in Manipulate form, with variables as controls following the expression.

I'd like to do something like this:
m = Manipulate[x y, {x, 0, 1}, {y, 0, 1}]
then do e.g.
Snapshot[m]
to get
DynamicModule[{x=0,y=0},x y]

Is perhaps the easiest way to do
List@@m
and then fiddle with the First for the expression and the Rest for the controls from which I'd extract the starting values?

I thought there might be a built-in function that does the equivalent of the Snapshot Button in the Manipulate.
POSTED BY: Philip Maymin
A soon as you do:
m = Manipulate[x y, {x, 0, 1}, {y, 0, 1}]
variable m remembers only initial values of parameters. Then when you play with interface controls they do not affect what is stored in the variable m.
POSTED BY: Sam Carrettie
Yup. I'd be fine with that. I just want a general function that will generate the corresponding snapshot DynamicModule with initial parameters for a given arbitrary Manipulate.
POSTED BY: Philip Maymin

I do not work Snapshot [m], someone can help me enter image description here

POSTED BY: Harvey Vargas

There is no command in Mathematica called Snapshot and that is why it did not work.

POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract