Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Tk behaviour

by donato (Novice)
on Feb 14, 2007 at 16:34 UTC ( [id://599985]=perlquestion: print w/replies, xml ) Need Help??

donato has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I just finishe developing a user app using Tk and now I have to fix one strange behaviour (by strange I mean: that which I do not understand). I have a loop that executes on a button callback and it executes a function and depending on the data returned by the function I have to show some things on the app window. Thing is: when the loop is being executed, and I change the text of a Label object, it does not "change" instantly. It is as if the loop blocks the app (if I put other windows on top of it, it is not redrawn). Here is a piece of the code, edited to fit here:
$err = $SiTef->ExecutaLoopAutorizacao( $SiTef, $params, $data ); while ( $err eq '10000' ) { #print Dumper( $params, $data ); #print "\nRETORNO: $err\n"; if ( $params->{UserMessage} ) { $Status = $params->{Message}; } $err = $SiTef->ExecutaLoopAutorizacao( $SiTef, $params, $data ); }
the GUI has this label:
my $Status; my $lblStatus = $mw->Label(-textvariable=>\$Status)->pack();
Is there something Im not getting about Tk programming, is there an easy way to fix this or should I go somewhere else?
------------------------------- Keep on PERLing the free world. ------donato-------------------

Replies are listed 'Best First'.
Re: Tk behaviour
by jdtoronto (Prior) on Feb 14, 2007 at 16:48 UTC
    To get the GUI to change you usually need to run the update method on the MainWindow,
    $mw->update();
    jdtoronto
      Thank you!!
      jdtoronto++ while (1);
      ------------------------------- Keep on PERLing the free world. ------donato-------------------

Log In?
Username:
Password:

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

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

    No recent polls found