Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.7K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How can we use While inside Manipulate?

Posted 10 years ago

Below is code which is supposed to create a window with a graphic, and then refresh is every 3 seconds until the Control "run" is unchecked. It creates the window and does the continuous refresh, but unchecking "run" has no effect. Can any of you please point out what I'm doing wrong?

Thanks

run = True;

window = CreateDocument[Dynamic[graphic], WindowSize -> {600, 450}, 
   TextAlignment -> Center, ShowCellBracket -> False, 
   WindowFrame -> "Frameless", WindowFrameElements -> {}];

Manipulate[
 While[run,
  points = Table[RandomReal[{-1, 1}, 2], 10];
  graphic = 
   ListPlot[points, PlotRange -> {{-1, 1}, {-1, 1}}, PlotLabel -> run];
  Pause[3];
  ];
 NotebookClose[window];
 Abort[],
 {run, {True, False}}
 ]

run

NotebookClose[window]
POSTED BY: David Keith
3 Replies

No problem!

POSTED BY: Jesse Friedman
Posted 10 years ago

Thank you, Jesse! Works great, and I learned something new!

POSTED BY: David Keith
POSTED BY: Jesse Friedman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard