[Tkinter-discuss] how to display terminal messages in a dialog boxusing tkinter

Gigs_ gigs at hi.t-com.hr
Sat Feb 23 15:27:25 CET 2008

brindly sujith wrote:
> hi
> i m developing a application using tkinter
> i want the messages that we get in the terminal to be displayed in the 
> tkinter dialog box
> do we have any option for that
> thank you
> ------------------------------------------------------------------------
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
maybe you could redirect sys.stdout to tkinter textbox. or make wrapper 
for stdout

or something like this

class Klass():
    def __init__(self):
        self.x = ''
    def write(self, c):
        self.x += c
    def writelines(self, l):
        for i in l:
            self.x += i
w = Wrapper()
 sys.stdout = w

and insert w.x to tkinter text
t.insert(1.1, w.x)
w.x = ''

dont know much about tkinter, but i hope that this help you

More information about the Tkinter-discuss mailing list