[GRASS5] Re: [GRASSLIST:8545] Re: d.m - commands output pollute the Grass terminal

Glynn Clements glynn at gclements.plus.com
Thu Oct 13 12:48:24 EDT 2005


Michael Barton wrote:

> >> This seems like a good idea, and is consistent with the behavior of the
> >> TclTk dialogs for each command.
> >> 
> >> Can anyone tell me if the TclTk code that creates the output window with
> >> progress bar for the command modules reasonably portable and where it is?
> > 
> > Look for "outtext" and "progress" in lib/gis/gui.tcl.
> 
> I think I can get a new paned window below the layer window in the GIS
> Manager. And it's pretty easy to set the command string to a variable. But I
> still can't see how this gets written to the window. Maybe I'm too sleepy
> and need to look at it again later.

The run_cmd procedure in gui.tcl does this:

	fconfigure $fh -blocking 0
	fileevent $fh readable [list prnout $dlg $fh]

where $fh is the file handle returned by "open" when running the
command (you have to use open rather than exec if you want to read the
process' output). The prnout procedure reads text from the handle and
adds it to the output window.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list