Redirecting stdin, stdout, and stderr to a window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael McGarry

    #1

    Redirecting stdin, stdout, and stderr to a window

    Hi,

    How do I redirect stdin, stdout and stderr to a window? I am using Qt
    for GUI.

    Thanks,

    Michael
  • Michael Fuhr

    #2
    Re: Redirecting stdin, stdout, and stderr to a window

    Michael McGarry <replytogroup@n ospam.org> writes:
    [color=blue]
    > How do I redirect stdin, stdout and stderr to a window? I am using Qt
    > for GUI.[/color]

    I don't know what specific mechanisms Qt provides, but the general
    solution is to write a class that implements I/O methods like read,
    readline, and write, and assign instances of that method to the
    input and output filehandles. For example, you could write a class
    with a write() method that displays text in a window, then assign
    an instance of that class to sys.stdout. Subsequent calls to 'print'
    would send output to the window.

    --
    Michael Fuhr

    Comment

    Working...