January 2002
Beginner
768 pages
25h 51m
English
In Chapter 22, we discussed the Netscape PerlPlus Plugin and used several PPL programs in our examples. We include two PPL programs in this appendix. The first is the clock-bezier.ppl program, shown in Figure C-3.

Figure C-3. clock-bezier.ppl
#!/usr/local/bin/perl -w # # This most entertaining program was written in Tcl/Tk by Scott Hess # (shess@winternet.com). It's a clock that uses a bezier curve anchored # at four points—the hour position, the minute position, the second # position and the center of the clock—to show the time. # # <Button-1> switches between display modes, and <Button-2> switches # between line thicknesses. # # Perl/Tk version by Stephen.O.Lidie@Lehigh.EDU, 2000/02/05. use POSIX qw/asin/; use Tk; use subs qw/buildclock hands setclock/; use vars qw/$clock %hand $mw $pi180 $resize/; use strict; %hand = ( hour => 0.40, minute => 0.75, second => 0.85, 0 => 0.00, intick => 0.95, outtick => 1.00, width => 0.05, scale => 100, type => 'bezier', types => [qw/normal curve angle bezier/], tindx => 3, normal => [qw/minute 0 0 second 0 0 hour 0 0 minute/], curve => [qw/minute 0 second 0 hour 0 minute/], angle => [qw/minute second second hour/], bezier => [qw/minute second 0 hour/], tick => [qw/intick outtick/], ); $pi180 = asin(1) / 90.0; $resize = 0; $mw = MainWindow->new; $clock = $mw->Canvas(qw/-width 200 -height 200/); $clock->pack(qw/-expand 1 -fill both/); ...
Read now
Unlock full access