Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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