in reply to Re: Tk::Canvas and using stipples
in thread Tk::Canvas and using stipples
Your example is remarkably similar to this one I found in the Mastering Perl/Tk:
#!/usr/local/bin/perl -w use strict; use Tk; my $mw = MainWindow->new(-background => 'white', -relief => 'flat'); my $stipple_bits = []; # important foreach my $b (1 .. 8) { push @$stipple_bits, pack('b8', '1' x $b . '0' x (8 - $b)); $mw->DefineBitmap("stipple$b" => 8, 1, $stipple_bits->[$b-1]); }; my $c = $mw->Canvas(qw/-width 200 -background white -relief flat/)->gr +id; $c->createLine(qw/20 20 180 20/); my $y = 40; for my $b (1 .. 8) { $c->createText(10, $y, -text => $b); $c->createLine(20, $y, 180, $y, -stipple => "stipple$b"); $y += 20; } MainLoop;
But as I mentioned above, it only stipples lines. It also works for -outlinestipple, but not -fill stipples.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Tk::Canvas and using stipples
by zentara (Cardinal) on Feb 04, 2006 at 13:47 UTC |