Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
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

3 Answers 3

up vote 3 down vote accepted

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.

share|improve this answer
    
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]
      ]
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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