Hi all,
first of all sorry, but I didn't know a better title.
#!/usr/bin/perl -w
use Tk;
my $mw =MainWindow ->new;
$mw -> title ("Untitled");
$mw -> Button(-text => "S H O W", -command => \&show)->grid(-row => 0,
+ -column => 0);
$mw -> Button(-text => "E X I T", -command => sub {exit})->grid(-row =
+> 0, -column => 1);
$lb2 = $mw -> Scrolled('Listbox', -width=> 30, -height => 10, -selectm
+ode => "single", -scrollbars => 'e', -setgrid =>1, -background => 'bl
+ack', -foreground => 'white') -> grid (-row => 1, -column => 0);
MainLoop;
sub show {
$lb2 -> delete(0,'end');
open(PIPE, "du -a 2>&1 |") or die "Could not open pipe: $!\n" ;
while (<PIPE>) {
chop ($_) ;
$lb2 -> insert('end',$_); }
close(PIPE) ;
}
exit (0);
When I push the SHOW button, it's relief stays sunken and the listbox (lb2) empty.
After the while loop has finished, the button's relief is restored to its original value and the listbox is filled with data.
What needs to be changed, so the listbox gets filled "live"?
I guess the button needs to be forced to change it's state/get released?
Regards,
unknown-monk
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.