Message Boards Message Boards

GROUPS:

Button[ ] doesn't work?

Posted 15 days ago
233 Views
|
3 Replies
|
0 Total Likes
|

(* This works *)

anima = False;
Button["Iniciar/Detener", If[anima, anima = False, anima = True]; 
 Print[anima]]

(* But this does not work *)

anima = False;
Button["Iniciar/Detener", If[anima, anima = False, anima = True]; 
 If[anima,
  ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2 Pi}]]]
3 Replies
Posted 15 days ago

Setting the Button as a Control in a Manipulate works

anima = False;
Manipulate[
    If[anima, ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2 Pi}], ""],
    Button["Iniciar/Detener", If[anima, anima = False, anima = True]],
    AppearanceElements -> None
]

Thanks for your help.

Posted 14 days ago

A minor, cosmetic, improvement (FrameMargins -> None):

anima = False;
Manipulate[
    If[anima, ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2 Pi}], ""],
    Button["Iniciar/Detener", If[anima, anima = False, anima = True]],
    AppearanceElements -> None, FrameMargins -> None
]
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