Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Perl/Tk window contents disappear when obscured then revealed

by choroba (Abbot)
on Jan 21, 2013 at 16:25 UTC ( #1014489=note: print w/ replies, xml ) Need Help??


in reply to Re: Perl/Tk window contents disappear when obscured then revealed
in thread Perl/Tk window contents disappear when obscured then revealed

In fact, $m->update works as entering the main loop. And even entering the main loop does not magically remove any blocking:

#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow -> new; my $m = $mw -> Message (-text => "testing, one, two, three...") -> pa +ck; $mw->Button(-text => 'Go', -command => \&fire)->pack; MainLoop(); sub fire { for my $n (1 .. 10) { print "$n\n"; sleep 1; } $m -> destroy; print "Done\n"; }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^2: Perl/Tk window contents disappear when obscured then revealed
Select or Download Code
Re^3: Perl/Tk window contents disappear when obscured then revealed
by BrowserUk (Pope) on Jan 21, 2013 at 16:31 UTC

    Update only works once; MainLoop effectively call update again whenever it is required.

    Of course, if you sleep for 10 seconds in a callback routine, control will not return to MainLoop for 10 seconds and no updates will be handled during that time.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: Perl/Tk window contents disappear when obscured then revealed
by Another Ed (Acolyte) on Jan 22, 2013 at 14:03 UTC
    Hi choroba, I tried your script, and unfortunately it gave the same unwanted effect as my example: the contents of the dialog had disappeared after the window was obscured then revealed while the 'for' loop was running. Ed
      That was the point of the script. It still misses the $mw->update inside the for loop.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-09-02 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (21 votes), past polls