3
$\begingroup$

How should I construct a code which opens a pop up window, displays a constantly updating image in it and is terminated once the pop up is closed? The constant updating would be an infinite loop of predefined functionality. Is this possible in Mathematica?

$\endgroup$

1 Answer 1

5
$\begingroup$

Simon's code

CreateDialog[
 {(a = RandomInteger[BernoulliDistribution[0.1], {200, 200}];
   Dynamic[ Image[a = 1 - Unitize[(# - 3) (# - 12) (# - 13)] &@
                     ListConvolve[{{1, 1, 1}, {1, 10, 1}, {1, 1, 1}}, a, {2, 2}, 0]]]), 
   DefaultButton[]}, Modal -> True]

Mathematica graphics

$\endgroup$
6
  • $\begingroup$ Wow, this looks cool. I wonder how the speed of evolution gets set since no Pause[] is used? $\endgroup$
    – Kagaratsch
    Commented Aug 21, 2015 at 3:20
  • $\begingroup$ @Kagaratsch I believe the actual display and the calculation are decoupled. In any case you may try to see how many FPS your system is capable of :D $\endgroup$ Commented Aug 21, 2015 at 3:22
  • $\begingroup$ Or post a question about that :D $\endgroup$ Commented Aug 21, 2015 at 3:23
  • $\begingroup$ Ok, let me edit the above question in order to specifically ask for a dynamic pop up involving the Pause[] command. $\endgroup$
    – Kagaratsch
    Commented Aug 21, 2015 at 3:25
  • 1
    $\begingroup$ @Kagaratsch Changing your question scope after you receive answers is a bad practice, I think $\endgroup$ Commented Aug 21, 2015 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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