whats wrong with this perl script?

Tarzan

New member
!perl
use Tk;

$mw=new MainWindow;
$mw->Label(-text=>"Please enter the equation you would like to evaluate. The symbols are as follows: \nplus+\nminus-\nmultiply*\ndivide/\nmodulus%\nexponent**\n")->pack();
$in=$mw->Entry(-width=>"20")->pack(-padx=>30);
$mw->Label(-text=>"The answer to the equation is $ans.\n")->pack();
$mw->Button(-text => 'Evaluate this equation', -command => sub{calc()} )->pack(-side => 'left', -padx => 30);
$mw->Button(-text=>'Exit', -command=>sub{exit})->pack(-side=>'right', -padx=>30);

MainLoop;

sub calc{
$equ=$in->get;
$ans=eval($equ);
$mw->update;
}

im trying to get the screen to refresh after calculating the answer but it wont.i know its calculating the number because if a i add a print statement it prints on the command prompt but the tk gui doesnt update

thnx in advance
im on windows so the path is fine and missing #
 
Back
Top