Newbie needs "interface"

Sean 'Shaleh' Perry shalehperry at
Thu Nov 22 17:34:02 CET 2001

On 22-Nov-2001 Roberto Bonato wrote:
> Hi all
>         I'm writing a function that implements an algorithm and that
> prints intermediate results all along the (usually very long)
> computation. Sometimes I want the results to be written on the stdout,
> sometimes on a Tkinter Text widget, sometimes to a file. I feel the need
> of something like a Java Interface with a method "write" to wrap all
> such devices into.
> Since I'm a newbie at programming and at Python in particular I still
> cannot find a simple and elegant way to do that. Thanks for any help.

python does a similar thing to what java does.  stdout has methods to act like
files (sys.stdout.write()).  The only missing piece is some glue to make the
Tkinter widget act like a file.  It may be there, it may not.

More information about the Python-list mailing list