in reply to simple tk counter

#!/usr/bin/perl # http://perlmonks.org/?node_id=1191710 use strict; use warnings; use Tk; my $count = 0; my $mw = MainWindow -> new; $mw -> Label(-text => 'Counter') ->pack(); $mw -> Label(-textvariable => \$count ) ->pack(); $mw -> Button( -text => 'Count', -command => sub { $count++ } ) ->p +ack(); MainLoop;

Replies are listed 'Best First'.
Re^2: simple tk counter
by dezboi (Initiate) on May 31, 2017 at 13:44 UTC

    Yeah, the use of -textvariableworked perfectly. Thank you tybalt89!