# Removing a ProgessIndicator when no longer needed

I have a progress indicator in my Mathematica notebook that I update as various calculations are performed:

indicator = ProgressIndicator[Dynamic[progress]];


I would like to figure out how to remove the indicator when the calculations are complete or in the case above when

progress == 1


I’ve looked through the documentation and can’t seem to find a good way to do this.

-
Does the second example in the Basic Examples section of Monitor in the docs look useful? –  kguler Apr 17 at 2:09
Good to know about Monitor but that didn’t help... –  Pam Apr 17 at 15:41

Let's just not draw it if the progress goal is achieved:

Dynamic[
x = Clock[3];
If[x < 1,
ProgressIndicator[x],
Sequence[]
]
]


Sequence can be "" or whatever is appropriate in your application.

-
All the answers are good… I didn’t explain my situation fully. Hence I will chose the first answer. –  Pam Apr 17 at 15:42

It is quite unclear where that element is, so maybe this approach will fit you needs:

progress := Clock[1, 1, 1];

nb = CreatePalette[DynamicWrapper[
ProgressIndicator@Dynamic@progress,
If[progress == 1, NotebookClose@nb], UpdateInterval -> 1]
]

-

Let's try such code:

trig = True;

pi = Dynamic[If[trig, ProgressIndicator[0.5], ""]];

pi


If trig is True, then ProgressIndicator is visible, otherwise it is not..

Playing with value of trig you can dynamically change the state of any visible elements.

-