O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

tkhp16c

tkhp16c is an RPN calculator we used for a splash screen example in Chapter 15. See Figure 15-6.

package Tk; use Tk::bindDump; # M A I N package main; use Tk; use Tk::MacProgressBar; use Tk::Splashscreen; use Tk::widgets qw/Compound ROText/; use subs qw/build_button_rows build_calculator build_help_window end splash/; use strict; my $mw = MainWindow->new; $mw->withdraw; $mw->title('Hewlett-Packard 16C Computer Scientist RPN Calculator'); $mw->iconname('HP 16C'); $mw->configure(-background => $GRAY_LIGHTEST); my $splash = splash; # build Splashscreen $splash->Splash; # show Splashscreen build_help_window; build_calculator; $MAC_PB->set($MAC_PB_P = 100); $splash->Destroy; # tear down Splashscreen $mw->deiconify; # show calculator MainLoop; # Miscellaneous subroutines. sub build_button_rows { my ($parent, $button_descriptions) = @_; foreach my $row (@$button_descriptions) { my $frame = $parent->Frame(-background => $GRAY_LIGHTEST); foreach my $buttons (@$row) { my ($p1, $p2, $p3, $color, $func) = @$buttons; $frame->Key( topl => $p2, -butl => $p1, -botl => $p3, -background => $color, -command => $func, ); } $frame->pack(qw/-side top -expand 1 -fill both/); $MAC_PB->set($MAC_PB_P += 10); } } # end build_button_rows sub build_calculator { &on; &on; # on/off kluge to initialize HP stack # LED display, help button, and HP logo. my $tf = $mw->Frame(-background => $SILVER); $tf->pack(qw/-side top -fill both -expand 1/); $tf->Label( -relief => 'sunken', -borderwidth => 10, -background ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required