replacments for stdio?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ido.Yehieli@gmail.com

    replacments for stdio?

    hi,
    i was wondering if anyone have written a GUI module that can
    function as a replacment for stdin/stdout? ie. has a file like
    interface, by which one could just assaign it to sys.stdout or
    sys.stdin and have all your prints and raw_inputs and other such things
    shown in a GUI window?

    Thanks in advance,
    Ido Yehieli.

  • Leif K-Brooks

    #2
    Re: replacments for stdio?

    Ido.Yehieli@gma il.com wrote:[color=blue]
    > i was wondering if anyone have written a GUI module that can
    > function as a replacment for stdin/stdout? ie. has a file like
    > interface, by which one could just assaign it to sys.stdout or
    > sys.stdin and have all your prints and raw_inputs and other such things
    > shown in a GUI window?[/color]

    Xterm?

    Comment

    • Ido.Yehieli@gmail.com

      #3
      Re: replacments for stdio?

      some thing platform independent will be preferable... (like a file like
      interface for TK/Tcl)

      Comment

      • Martin Miller

        #4
        Re: replacments for stdio?

        Here's a suggestion for you:
        Check out the comp.lang.py thread titled "Catching stderr output from
        graphical apps" at[color=blue]
        > http://groups.google.com/group/comp....f604115b5e914e[/color]

        I strongly suspect that the code discussed could probably be adapted to
        handle sys.stdout instead of, or in addition to, output to sys.stderr.

        It also sounds like it can be made platform independent.

        Best,
        -Martin

        P.S. Please post your results back to the newsgroup -- thanks!


        Ido.Yehi...@gma il.com wrote:[color=blue]
        > hi,
        > i was wondering if anyone have written a GUI module that can
        > function as a replacment for stdin/stdout? ie. has a file like
        > interface, by which one could just assaign it to sys.stdout or
        > sys.stdin and have all your prints and raw_inputs and other such things
        > shown in a GUI window?
        >
        > Thanks in advance,
        > Ido Yehieli.[/color]

        Comment

        • Ido.Yehieli@gmail.com

          #5
          Re: replacments for stdio?

          Thanks martin,
          I'll give it a shot as soon as i get back from work!

          Comment

          • Martin Miller

            #6
            Re: replacments for stdio?

            Ido,

            I tried Bryan Olson's code [on Windows] from his last post to the
            "Catching stderr output from graphical apps" thread <see
            http://groups.google.c om/group/comp.lang.pytho n/msg/d61f1d5e02d8417 8>,
            and it seemed to work for stdout as well as stderr output.

            To enable its use with stdout, all I had to do was un-comment the last
            line in Bryan's post, namely[color=blue]
            > # sys.stdout = ErrorPipe()[/color]
            and the any stdout output starting would appear in a separate window.

            Since it's based on Tkinter, and from what Bryan said in his post, I
            believe it's a fairly portable solution. [Nice work, Bryan!]

            Best,
            -Martin


            Ido.Yehieli@gma il.com wrote:[color=blue]
            > Thanks martin,
            > I'll give it a shot as soon as i get back from work![/color]

            Comment

            • Ido.Yehieli@gmail.com

              #7
              Re: replacments for stdio?

              yes,
              I've tried it aswell - nice work indeed!

              now, maybe also get stdin to work from this TK window... ;-)

              Comment

              • Ido.Yehieli@gmail.com

                #8
                Re: replacments for stdio?

                the source (and Bryan) doesn't say anything about further distribution
                - and he did not provide a real email address.
                Can I safely modify it and include it in the source distribution of my
                program (it is open source licensed)? Would that be the polite thing to
                do, i have no idea how to contact this guy?

                Comment

                • Martin Miller

                  #9
                  Re: replacments for stdio?

                  In what way would you like to get "stdin to work"? In Bryan's post in
                  the Application(Fra me).__init__() he binds some lambda functions to key
                  strokes which allow control-C copying of text in the window.

                  Seems like additonal application-specific things might be possible, but
                  then the code would no longer be generic. Interaction with the main
                  application would likely be tricky because each output window is
                  lanuched as a separate process when output is first sent to it.

                  As far a redistribution goes, I would think anything posted to the
                  public comp.lang.pytho n usenet newgroup is unencumbered unless the
                  author indicates otherwise -- or at most covered by the same open
                  source license as Python.

                  -Martin


                  Ido.Yehieli@gma il.com wrote:[color=blue]
                  > yes,
                  > I've tried it aswell - nice work indeed!
                  >
                  > now, maybe also get stdin to work from this TK window... ;-)[/color]

                  Comment

                  • Ido.Yehieli@gmail.com

                    #10
                    Re: replacments for stdio?

                    Yes, i thought so myself.

                    Thanks,
                    Ido.

                    Comment

                    Working...