Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: TK screen problem

by Sandy (Curate)
on Oct 31, 2008 at 14:37 UTC ( [id://720709]=note: print w/replies, xml ) Need Help??


in reply to TK screen problem

If your Tk program is busy doing stuff when you switch to and from another window, then the Tk image will not be re-drawn.

So, as anon suggested, pepper your code with $mw->update() in long loops, or processing sections etc.

For efficiency sake (i.e. don't slow down your program) do NOT

foreach my $i (1..10000) { ... do stuff $mw->update(); }
instead, only update sometimes (every 100 iterations perhaps?)
foreach my $i (1..10000) { ... do stuff if (int($i/100)*100 == $i) { $mw->update(); } }

Replies are listed 'Best First'.
Re^2: TK screen problem
by lostjimmy (Chaplain) on Oct 31, 2008 at 16:18 UTC
    if (int($i/100)*100 == $i) {
    That can be more concisely written as if ($i % 100 == 0) {

      Or:

      unless ($i % 100) {

      :P

      I'm so adjective, I verb nouns!

      chomp; # nom nom nom

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://720709]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-03-28 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found