3
$\begingroup$

I made the button below for launching an Animate, but it doesn't work at all! Why?

Button["Plot", Animate[Plot[k x, {x, 0, 3}], {k, -2, 2}]]

Thanks in advance.

$\endgroup$
3
$\begingroup$

I found the following to give the result that I think you are looking for. I believe that Animate needs a window to run in.

Button["Plot", MessageDialog[Animate[Plot[k x, {x, 0, 3},
 PlotRange -> {{0, 3}, {-8,8}}], {k, -2, 2}]], Method -> "Queued"]

The Method->"Queued" has been discuss in many other threads.

$\endgroup$
2
$\begingroup$
Button["Plot",Animate[Plot[k x,{x,0,3},PlotRange->{{0,3},{-8,8}}],{k,-2,2}]//CreatePalette]

Reference. Also, updated on PlotRange based on @JohnMcGee's answer.

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.