Re: How to make a progress bar?

*To*: mathgroup at smc.vnet.net*Subject*: [mg70016] Re: How to make a progress bar?*From*: albert <awnl at arcor.de>*Date*: Sat, 30 Sep 2006 05:12:48 -0400 (EDT)*References*: <efgan3$pra$1@smc.vnet.net>

Hi, > 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? It is possible, but not straightforward. The following assumes you are using the notebook frontend, not the pure kernel. What would come closest to what you have in mind is to use CellPrint to write a cell that is marked with a special CellTag. When you want to add a point, you could use frontend programming to delete the old cell and write a new cell with one point added. If you think that sounds complicated for a simple task, I fully agree. The approach is something I would recommend only if e.g. you want to show the progress in some kind of plot or more complicated information which needs complex formatting. If I have to give simple status like information I prefer to write it to the statusline of the frontend, which after all is what the status line is for. If you search the archives for WriteStatus you will find postings with explicit code which does this. Last but not least you could look into the GUIKit documentation which comes with versions > 5.0 and contains examples of how to create a real status bar window. hth, albert