MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to make a progress bar?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70032] Re: How to make a progress bar?
  • From: "David Reiss" <dbreiss at gmail.com>
  • Date: Sun, 1 Oct 2006 04:08:13 -0400 (EDT)
  • References: <efgan3$pra$1@smc.vnet.net>

The trick is to use Notebook Programming.  Generally functions like
Print, and Return are in Mathematica for the sake of those coming from
other languages, but they are quit restrictive and you can't get very
far with them..

But the real powerful thing is to remember that Cells and Notebooks are
expressions that you can manipulate just as any other expression in
Mathematica.

So with this in mind here is a refined example that might get you
started along the path you want to go.  First do something like this.

In one input Cell execute the following to create a cell with a
specific cell tag:


CellPrint[Cell[" ","Text",CellTags->"progress"]]


Now, in another cell in the same notebook, execute the following  which
finds and then writes into the end of the text in the cell that was
created by executing the previous input line


Do[

  Module[{nb},
    nb=EvaluationNotebook[ ];
   
    NotebookFind[EvaluationNotebook[ ],"progress",All,CellTags,
      AutoScroll\[Rule]False];
   
    SelectionMove[nb,After,CellContents,AutoScroll\[Rule]False];
    NotebookWrite[nb, "x"];
    Pause[1]
    ],

  {i,1,15}]



  Take a look at http://scientificarts.com/worklife for the sorts of
things you can do with notebook programming and a bunch of tools that
make some of it more accessible. (Shameless plug for a useful product!)



Andrey B. wrote:
> Hello,
> Does anybody know how to force Mathematica to put symbols in one
> continuous line by repeatedly call the operator (say Print[]). If we
> call Print["a"] twice - we get two lines, and I want one line "a,a"
>
> It is common question when I do something like
>
> Do[
> MyFunction; (*Complicated and Very long*)
> Print["."] (*printed dot makes me know that an iteration has done*)
> ,{imax}]
>
> I get many lines with dot and I want ONE progress bar line growing,
> like
> .........
>
> but not
> .
> .
> .
> 
> Is there any chance?
> 
> Thanks,
> Andrey B.


  • Prev by Date: Re: importing html files
  • Next by Date: Re: Input, output troubles me ...
  • Previous by thread: Re: four argument form of infix
  • Next by thread: Re: Input, output troubles me ...