#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; my %button; foreach my $num (0..9){ $button{$num} = $mw -> Button( -text => $num, -background => 'grey', -width => 5, -height => 2, # -command => $number=$number==0||$equals!=0?$input:$number.$in +put, -command => sub{ print "$num\n"; #do whatever here } ) -> pack(); } MainLoop;
In reply to Re: Making a button execute a command: Tk
by zentara
in thread Making a button execute a command: Tk
by Andrew_Levenson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |