Skip to main content
3 of 4
edited tags
Kuba
  • 137.7k
  • 13
  • 289
  • 751

How to create a window which will close in a certain amount of time?

I'm currently making an interface in Mathematica and I'll need to bump a window out and then let it close itself in a certain amount of time.

Here's an short example to illustrate the effect:

new = CreateDialog[Plot[x^2, {x, 0, 1}]];
Pause@3;
NotebookClose[new]

However, I may need the window to keep opening for minutes before it close itself and at the same time, there'll be a lot of processes and calculations running:

t=Now;
new = CreateDialog[Plot[x^2, {x, 0, 1}]];
Pause@3;
NotebookClose[new]
Prime /@ Range@1000000;
Now-t
(*A long time......consumed 3s unnecessary time*)

This will not be acceptable.

So, my problem is, how to solve this problem?

Wjx
  • 9.7k
  • 1
  • 34
  • 70