our $dis = $mw->Entry( -width => '30' )->pack; # Changed width from 10 to 30
####
sub CLxsub
{
$x=0;
$dis->delete('0.0','end');
}
sub xsysub
{
$x = $y;
$y = $dis->get;
$dis->delete('0.0','end');
$dis->insert('end',$x);
$res='s';
}
sub Rssub
{
my $aj=$dis->get;
$dis->delete('0.0','end');
$dis->insert('end',$y);
$x=$y;
$y=$z;
$z=$t;
$t=$aj;
$res='s';
}
####
sub CLxsub {
$x = 0;
$dis->delete( '0.0', 'end' );
}
sub xsysub {
$x = $y;
$y = $dis->get;
$dis->delete( '0.0', 'end' );
$dis->insert( 'end', $x );
$res = 's';
}
sub Rssub {
my $aj = $dis->get;
$dis->delete( '0.0', 'end' );
$dis->insert( 'end', $y );
$x = $y;
$y = $z;
$z = $t;
$t = $aj;
$res = 's';
}
####
my $STO = $mw->Button(
-text => 'STO',
-command => sub{$sto='s'},
-width =>'1',
-height =>'1',
-foreground => 'white',
-background => 'black'
)->pack;
$STO->place(-x=>100 + $xxx,-y=>'170');
####
sub button($$$$$;$$$$) {
my ($parent, $text, $pcmd, $x, $y, $fg, $bg, $width, $height) = @_;
# Defaults
$fg ||= 'white';
$bg ||= 'black';
$width ||= 1;
$height ||= 1;
# Color abbreviations
my $p_abb = {
'db' => 'darkblue',
'dg' => 'darkgoldenrod',
};
defined($p_abb->{$fg}) and $fg = $p_abb->{$fg};
defined($p_abb->{$bg}) and $bg = $p_abb->{$bg};
# Create the button widget (note command need not be given)
my $b = $parent->Button(-text => $text);
$pcmd and $b->configure(-command => $pcmd);
$b->configure(-width => $width, -height => $height);
$b->configure(-foreground => $fg, -background => $bg);
# Place the button (no need to "pack" it first!), and return it
$b->place(-x => $x, -y => $y);
return $b;
}
####
button($mw, 'Enter', [\&entersub], 197, 155);
button($mw, '+', [\&somasub], 353, 170);
button($mw, '-', [\&subtrasub], 353, 140);
button($mw, 'x', [\&multisub], 353, 110);
button($mw, '/', [\&divisub], 353, 80);
button($mw, 'CLx', [\&CLxsub], 133, 140);
button($mw, 'xsy', [\&xsysub], 100, 140);
button($mw, 'Rs', [\&Rssub], 66, 140);
button($mw, 'SST', [\&Rssub], 33, 140);
button($mw, 'R/S', [\&Rssub], $xxx, 140);
button($mw, 'RCL', sub{$rcl = 's'}, $xxx+133, 140);
button($mw, 'STO', sub{$sto = 's'}, $xxx+100, 170);
button($mw, 'g', 0, $xxx+66, 170, 0, 'db');
button($mw, 'f', 0, $xxx+33, 170, 0, 'dg');
button($mw, 'OFF', sub{exit}, $xxx, 170);