Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by choroba (Cardinal)
on Jan 21, 2013 at 16:25 UTC ( [id://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"; }
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^3: Perl/Tk window contents disappear when obscured then revealed
by BrowserUk (Patriarch) 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 (Sexton) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1014489]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-18 13:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found