Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Tk subroutine

by props (Hermit)
on Sep 23, 2007 at 16:39 UTC ( [id://640595]=perlquestion: print w/replies, xml ) Need Help??

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

Hi again I have some progress here . It does create a new record for every add_button press BUT the count function does not increase at all and the balance is dead too. Im getting confused with the Static pragma i assume . I read allot about it but i do not use it correctly.
sub add_button { my $addframe = $frm_name4->Frame( -background=>'yellow', -relief=>'groove', -borderwidth=>5) ->pack(-side=>'top', -fill =>'x'); my $addtxtcount = $addframe->Text( -width=>10, -height=>1) ->pack(-side=>'left', -anchor =>'nw'); my $addtxtexpense = $addframe->Text( -width=>8, -height=>1) ->pack(-side=>'left', -anchor =>'nw', -padx=>5); my $addtxtcost = $addframe->Text( -width=>8, -height=>1) -> pack(-side=>'left', -anchor =>'nw', -padx=>10); chomp(my $expense = $expenseentry->get()); $expenseentry -> delete('0', 'end'); $addtxtexpense->insert('end',$expense); #cost posting chomp(my $cost = $costentry->get()); $costentry-> delete('1.0','end'); $addtxtcost->insert('end',$cost); #countig posting my $count +=1; print $count; $addtxtcount->insert('end',$count); #calculate balance my @totalbalance = 0; push(@totalbalance,$cost); foreach( @totalbalance) { my $total += $_; ##write new balance $balancetxt->delete('1.0','end'); $balancetxt->insert('end',$total); #open WRITEFILE , ">>$time.txt" or die "write error\n"; #print WRITEFILE ("$count) $expense $cost \n"); #close WRITEFILE; } }

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

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

    No recent polls found