wxLogMessage format

Hi Everybody,

I’ve been trying to use wx.LogMessage to output child’s process Stdout into a wx.LogWindow frame launched from the main app.

Main app periodically polls child’s process stdout and calls wx.LogMessage.

The child process does either ‘print text’ statements or ‘os.write(1,"%s \r" %text)’.

Note this second output method with ‘\r’ carriage return was intended to print a single line of text which changes instead of printing several lines (for example a percentage progress indication or a timeout decremetation produced from a loop). This worked fine when launching the child standalone in console mode (i.e. from a Dos or Cygwin shell window).

Now when using wxLogMessage to display on wxLogWindow the child’s Stdout produced from looped os.write(1,"%s \r" %text) calls, the result is shown in several lines. It is like the ‘\r’ does not make any effect on the wxLogMessage, or like wxLogMessage adds a ‘\n’ to every display message.

Does anybody know if is it possible to use wxLogMessage or a similar wx logging function to display several output lines on a single one by using ‘\r’ or similar method ?

Thanks

Jordi Pavard wrote:

Hi Everybody,
I've been trying to use wx.LogMessage to output child's process Stdout into a wx.LogWindow frame launched from the main app.
Main app periodically polls child's process stdout and calls wx.LogMessage.
The child process does either 'print text' statements or 'os.write(1,"%s \r" %text)'.
Note this second output method with '\r' carriage return was intended to print a single line of text which changes instead of printing several lines (for example a percentage progress indication or a timeout decremetation produced from a loop). This worked fine when launching the child standalone in console mode (i.e. from a Dos or Cygwin shell window).
Now when using wxLogMessage to display on wxLogWindow the child's Stdout produced from looped os.write(1,"%s \r" %text) calls, the result is shown in several lines. It is like the '\r' does not make any effect on the wxLogMessage, or like wxLogMessage adds a '\n' to every display message.
Does anybody know if is it possible to use wxLogMessage or a similar wx logging function to display several output lines on a single one by using '\r' or similar method ?

A text ctrl is not a terminal, so don't expect it to always behave the same way. A textctrl is for displaying and possibly editing text. If you add text to it then you add the text to the document and it displays it, without any concept of overwriting existing text if there is already some on the same line like a terminal will (unless it supports an overwirte mode of course.)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!