[EMAIL PROTECTED] wrote: > Hi Friends, > > I am presently working on an Automation project where I am using Active > state perl as the programming language on windows platform. For the > above mentioned project I am using Perl/Tk for the GUI. I created a Text > Widget and wanted to show the output from my perl code on the text box. > I tried tieing the STDOUT to the text box , but the output is shown only > after the program is terminated. What ever I am printing to STDOUT is > accumulated and shown at once after the program is terminated. I wanted > to show them as and when the program is running. I don't know where I am > mistaken. Please help me in this regard. > > Thanks is Advance, > > Vinesh
The text appearing in a Tk [or any other GUI library] widget is an attribute, generally '-text', of the widget. It has nothing to do with standard input/output communications. In order to properly manage the behavior of Tk widgets, you must understand the widget itself. perldoc Tk::Text perldoc Tk::WidgetName Joseph Hmmm--this didn't go through to the group because something hashed the list address. Just as well. The Tk docs are very poor in samples, so here is a small working example of loading some text to a Text widget. They are complicated little buggers, and if you do the lead work of reading the docs, I am happy to help clarify some of the questions the docs raise. I'm sure others will be also, but you do have to start by reading the docs for any Tk widget you are trying to use. my $text = ''; open IN, "txt/txt$padded_path.txt" or die "Could not open $!"; my $line; $text .= $line while $line = <IN>; close IN or die "Could not close $!"; my $text_area = $message_area->{'SubWidget'}->{'text'}; $text_area->delete('0.1', 'end'); $text_area->insert('end', $text); The snippet above clears a text widget entirely, and loads it from the start--in this case, also the end, with the new text held in $text. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>