Redirecting stdin, stdout, and stderr to a window

Discussion in 'Python' started by Michael McGarry, Dec 16, 2004.

  1. Hi,

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

    Thanks,

    Michael
     
    Michael McGarry, Dec 16, 2004
    #1
    1. Advertisements

  2. Michael McGarry

    Michael Fuhr Guest

    Michael McGarry <> writes:

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


    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
    http://www.fuhr.org/~mfuhr/
     
    Michael Fuhr, Dec 16, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Landenburer

    redirecting stderr and stdout

    Jon Landenburer, May 12, 2004, in forum: Perl
    Replies:
    1
    Views:
    11,512
    Joe Smith
    May 13, 2004
  2. Jan Knop
    Replies:
    4
    Views:
    1,408
    Jan knob
    Nov 24, 2003
  3. Matthew Thorley

    Redirecting stdout and stdin

    Matthew Thorley, Mar 4, 2004, in forum: Python
    Replies:
    2
    Views:
    855
    Donn Cave
    Mar 4, 2004
  4. Vincent Touquet
    Replies:
    1
    Views:
    895
    Adrian B.
    Sep 3, 2004
  5. Martijn Brouwer

    closing stdin, stdout and stderr

    Martijn Brouwer, Dec 26, 2005, in forum: Python
    Replies:
    5
    Views:
    1,424
    Donn Cave
    Dec 27, 2005
  6. Lincoln Yeoh

    Redirecting stderr and stdout to syslog

    Lincoln Yeoh, Aug 5, 2008, in forum: Python
    Replies:
    2
    Views:
    2,570
    Lincoln Yeoh
    Aug 6, 2008
  7. Ian Hobson
    Replies:
    0
    Views:
    920
    Ian Hobson
    Sep 6, 2010
  8. it_says_BALLS_on_your forehead
    Replies:
    2
    Views:
    491
    Joe Smith
    Jan 10, 2006
Loading...