banango has asked for the wisdom of the Perl Monks concerning the following question:
use Tk; $mw = new MainWindow; $mw->title("Test"); $mw->Label(-text => "Pick an item from the list")->pack; $frm_versions=$mw->Frame()->pack; $list=$frm_versions->Listbox(-selectmode=>'single', -width=>0, -height +=>0); $list->pack; $list->insert('end', 'Text', 'MoreText', 'TextityTextText', 'TextyText +alicious', 'Textathon'); $textarea=$mw->Frame()->pack; $txt=$textarea->Scrolled("Text", -scrollbars=>'e', -width=>45, -height +=>10); $txt->pack; $mw->Button(-text => "GO!!!!", -command => \&go)->pack(-side => 'botto +m', -expand => 1, -fill => 'x'); MainLoop(); sub go{ $listselection=$list->curselection(); if ($listselection eq "") { $todo = ""; }else { $todo=$list->get($listselection); } $txt -> delete('0.0', 'end'); if ($todo){ $txt -> insert('end',"Let's see what you picked...\n\n\n"); sleep (2); $txt -> insert('end',"You picked $todo...\n"); }else{ $txt->insert('end',"Please pick something from the list...\n"); last; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unbuffered printing to tk text widget
by zentara (Cardinal) on May 23, 2007 at 15:40 UTC | |
by banango (Initiate) on May 23, 2007 at 16:50 UTC | |
|
Re: Unbuffered printing to tk text widget
by johngg (Canon) on May 23, 2007 at 15:23 UTC |