In perl TK there is the
$widget->update() function.
But that will only help, if you call it often enough from in your sub.
For example:
#!/usr/bin/perl -w
use strict;
use Tk;
my $mw = MainWindow->new();
my $b1 = $mw->Button()->pack;
my $b2 = $mw->Button(-command => \&test )->pack;
MainLoop;
sub test {
print "start";
$mw->update();
for my $i (0..10000) {
if ($i % 20 == 0) {
print "$i\n";
$mw->update();
}
}
print "thats it";
}
This works. So you can push 'button1' until the sub is running.
But remember, that you have to update your mainwindow very often.
If you want to run your sub in background, you can use fork as explained above.
But maybe you want to use the results of your sub for your Tk display.
in that case You should use a kind of pipe for that. But I think the
update function could help you.
Also look for afterIdle, DoWhenIdle, idletasks. Maybe they are needful to you
-----------------------------------
--the good, the bad and the physi--
-----------------------------------
In reply to Re: Perl TK
by physi
in thread Perl TK
by HamNRye
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.