redirect of standard output of jython to JTextArea

Jan Gregor gregor.jan at NOSPAM.quick.cz
Thu Jan 27 06:07:57 EST 2005


Hello

  I want to redirect output of jython's functions print and println to 
JTextArea component. Is it possible ?

I tried this (swingConsole.textArea is instance):

In my class

  self.printStream= MyPrintStream(System.out)
	System.setOut(self.printStream)

----------------------------------------------------
class MyPrintStream (PrintStream):

	def println (str):
		swingConsole.textArea.append(str)

	def print (str):
		swingConsole.textArea.append(str)


Output is still directed to standard output.


Thanks for help,
Jan



More information about the Python-list mailing list