Pipe stdout && stderr to a TkLabel widget

rantingrick rantingrick at gmail.com
Mon Jan 26 14:51:54 EST 2009


I am wondering how i might pipe stdout && stderr to a Tkinter Label
widget. here are a few ways to set the text

#-- Create a label --#
label = Label(master, text='Default Text')
label.pack()

# -- two ways to change the text --#
label['text'] = 'New Text'
label.configure(text='New Text')

#-- or use a control variable --#
v = StringVar(master)
label.config(textvariable=v)

#-- Change useing variable --#
v.set('NewText')

So my question is -- I know hoe to set the text displayed in the label
wiget, but hoow do i capture stdout and send that to the widget?






More information about the Python-list mailing list