Writing to the IDLde [message #52549] |
Tue, 13 February 2007 12:07  |
news.verizon.net
Messages: 47 Registered: August 2003
|
Member |
|
|
This message will reveal me as a dinosaur, but I am still trying to
maintain programs that display output to a terminal, continuously
overwriting the previous result. For example, the following
little program will continously display the number of seconds since
the program started:
pro test, x
cr = string(13b)
for i=0,50 do begin
wait,1
print,i,cr,f='($,a,a)'
endfor
end
However, this program only works at a Unix terminal: in the IDLDE (Mac
or Unix), the carriage return can't erase the previous text.
Perhaps, there is some combination of carriage return, linefeed and/or
newline suppression format that works with the IDLde but I couldn't
locate it.
Of course,I could write the output to a text widget, and update/
overwrite using WIDGET_CONTROL as needed. But this would require
fairly major changes ot existing code.
A possibly related question is whether it is possible to display text
to the IDLde using the /MORE option. At a terminal, one can use
openw,lun,filepath(/terminal),/more,/get_lun . I had always assumed
that this wasn't possible to do this in the IDLde, but compiling with
the -t option does give /MORE output.
Thanks, --Wayne
|
|
|
Re: Writing to the IDLde [message #52677 is a reply to message #52549] |
Wed, 14 February 2007 10:58  |
KRDean
Messages: 69 Registered: July 2006
|
Member |
|
|
On Feb 13, 1:07 pm, "Wayne Landsman" <vze49...@verizon.net> wrote:
> This message will reveal me as a dinosaur, but I am still trying to
> maintain programs that display output to a terminal, continuously
> overwriting the previous result. For example, the following
> little program will continously display the number of seconds since
> the program started:
>
> pro test, x
> cr = string(13b)
> for i=0,50 do begin
> wait,1
> print,i,cr,f='($,a,a)'
> endfor
> end
>
> However, this program only works at a Unix terminal: in the IDLDE (Mac
> or Unix), the carriage return can't erase the previous text.
> Perhaps, there is some combination of carriage return, linefeed and/or
> newline suppression format that works with the IDLde but I couldn't
> locate it.
>
> Of course,I could write the output to a text widget, and update/
> overwrite using WIDGET_CONTROL as needed. But this would require
> fairly major changes ot existing code.
>
> A possibly related question is whether it is possible to display text
> to the IDLde using the /MORE option. At a terminal, one can use
> openw,lun,filepath(/terminal),/more,/get_lun . I had always assumed
> that this wasn't possible to do this in the IDLde, but compiling with
> the -t option does give /MORE output.
>
> Thanks, --Wayne
Instead of print, use printF and send the output to a text file. Then
in the MS-DOS window, use the CYGWIN program "tail". It behaves just
like the UNIX command tail.
dos>tail -f idl-log.txt
Cygwin provides unix-like environment commands for Windows. The
"tail" option -f will display the contents added to the text file as
it grows.
Kelly Dean
Fort Collins, CO
|
|
|
Re: Writing to the IDLde [message #52680 is a reply to message #52549] |
Wed, 14 February 2007 09:04  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Wayne Landsman writes:
> Well, my original problem is to update a program
> (http://idlastro.gsfc.nasa.gov/ftp/pro/tv/curval.pro ) that continuously
> displays derived values depending on the cursor position. It is similar
> to the IITVIS routine RDPIX, which displays only the cursor position and
> intensity. Interestingly, IITVIS does not consider RDPIX to be an
> obsolete routine, even though it does not work under the IDE (and thus not
> under Windows).
Wayne, if you can't get anything else to work, you can
steal most of the code for READ_PIXEL, which is a RDPIX
that works:
http://www.dfanning.com/tips/read_pixel.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Writing to the IDLde [message #52681 is a reply to message #52549] |
Wed, 14 February 2007 08:58  |
wlandsman@jhu.edu
Messages: 12 Registered: September 2006
|
Junior Member |
|
|
"R.G. Stockwell" <no@email.please> wrote in message
news:45d33716$0$25788$815e3792@news.qwest.net...
>
> Right, I agree that you cannot do it to the IDE window.
> What I meant was to have a function that did some
> appropriate solution, such as a "progress" widget like
> Dave Fanning's. Or one could make a graphics window
> and xyout the message.
....
> There are a lot of possibilites, and it should be very straightforward
> to implement. If not, perhaps the OP can elaborate on what the problem
> is.
Well, my original problem is to update a program
(http://idlastro.gsfc.nasa.gov/ftp/pro/tv/curval.pro ) that continuously
displays derived values depending on the cursor position. It is similar
to the IITVIS routine RDPIX, which displays only the cursor position and
intensity. Interestingly, IITVIS does not consider RDPIX to be an
obsolete routine, even though it does not work under the IDE (and thus not
under Windows).
The main purpose of my original post was to make sure there was not some
trick to make the IDE overwrite a line, which would have been the easiest
solution. I will go ahead and create a widget display if the user is using
the IDLDE. It was helpful to receive the suggestion of writing a drop-in
replacement for PRINT.
I even looked at Iimage which continuously displays cursor position and
intensities by default, but which seems to require a month's work to
reprogram to display astronomical coordinates. --Wayne
|
|
|
|