Shell-Output in Tkinter-Windows

wjk wjk at wjk.mv.com
Tue Sep 5 23:58:18 EDT 2000


Hi - am just starting to learn Tkinter
in Tcl/Tk -- i would normally pipe in the data from a shell
program...
text widget would have a state of normal and i would
insert the data into the text widget     ... insert end $dataline
then change the state of the text widget to disabled -- thus
you would get an uneditable text box.. something like below:

text .t1 -state normal other attributes
set fp1 [ open "| xyz.scr" r ]   -- long time since i did this -- open pipe
while { [ gets $fp1 dataline ] >= 0 } {
     .t1 insert end "$dataline\n"           -- read dataline and put in text
widget
}
.t1 configure -state disabled             -- set state of text widget to
disabled
 close $fp1                                       -- close your pipe

For a label -- i would have defined the label and assigned a variable
name for any data i want to use.. read some small text for that label
assigning it to the label's textvariable...

label .lb1 -text "" -textvariable stuff

read in something and assign to that variable $stuff
then the label would change with no problem -- you
might have to update or update idletasks depending on
what is going on

This i hope will give you a little info on how to get Tkinter to work
for ya. Now if someone would come along and put it into Tkinter
we will both learn something

cheers

rok wrote:

> - How can I get the Python-Shell-Outputs into my Tk-Window? I'd like it
> to appear in an "uneditable" Text or Label-Widget at the bottom of my
> Window?
>
> - I've got Problems with the Grid-Manager: The sticky E or W works fine,
> but sticky N and S doesn't seem to do anything to the Objects. Are there
> special things to care for?
>
> Any help is apreciated very much!
>
> Rok




More information about the Python-list mailing list