logging to a text widget

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Thu Mar 2 07:57:25 EST 2006


Alexandre Guimond wrote:
> Hi. I'm using the logging package. I would like to send my log messages
> to a Text widget creating using Tkinter. I was wondering if there was a
> logging handler class that would do this. It seems that the standard
> handlers do not support this. Has anyone tried to do this?
> 

Alex,

To be honest I haven't used the logging package (it's on my todo list ;)
but I normally sub class the Text widget, give it a write method then
send stdout / stderr to it normally (sys.stdout = mytextWidget)

At the same time I also add scrollbars and in the write method I scroll 
to the latest message.

Cheers
Martin



More information about the Python-list mailing list