Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dod38fr/perl-tk-canvas-draw
Simplifies drawing with a mouse in a perl/Tk Canvas
https://github.com/dod38fr/perl-tk-canvas-draw
Last synced: 2 days ago
JSON representation
Simplifies drawing with a mouse in a perl/Tk Canvas
- Host: GitHub
- URL: https://github.com/dod38fr/perl-tk-canvas-draw
- Owner: dod38fr
- Created: 2015-12-05T17:04:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-06T08:55:31.000Z (about 9 years ago)
- Last Synced: 2025-01-02T23:57:16.309Z (6 days ago)
- Language: Perl
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
Awesome Lists containing this project
README
Tk-Canvas-Draw
Here's a quick example to stimulate your immediate excitement.
The following program 'doodle' lets you draw colorful freehand
lines in a Tk Canvas!use strict;
use warnings;
use Tk;
use Tk::Canvas::Draw;my $help = qq[
Click and move the mouse anywhere in the white box to begin drawing.
Type 'Escape' to clear everything.
];my $a_all_ids = [ ];
my $mw = new MainWindow(-title => 'Doodle -- Tk::Canvas::Draw example');
my $cv = $mw->Canvas(-bg => 'white', -width => 512, -height => 512)->pack;
$cv->createText(0, 0, -anch => 'nw', -text => $help);
Tk::Canvas::Draw->new($cv, \&done_drawing, { width => 5 });
$mw->bind("" => sub { map { $cv->delete($_) } @$a_all_ids });
MainLoop;# Tk::Canvas::Draw callback -- reinstall callback with a new, random color
sub done_drawing {
my ($o_obj, $a_points, $a_ids) = @_;
push @$a_all_ids, @$a_ids;
my $color = sprintf "#%02x%02x%02x", rand(256), rand(256), rand(256);
$o_obj->restart( { color => $color });
}INSTALLATION
To install this module, run the following commands:
perl Makefile.PL
make
make test
make installSUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the
perldoc command.perldoc Tk::Canvas::Draw
You can also look for information at:
RT, CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tk-Canvas-DrawAnnoCPAN, Annotated CPAN documentation
http://annocpan.org/dist/Tk-Canvas-DrawCPAN Ratings
http://cpanratings.perl.org/d/Tk-Canvas-DrawSearch CPAN
http://search.cpan.org/dist/Tk-Canvas-Draw/LICENSE AND COPYRIGHT
Copyright (C) 2010 jcnorton
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.See http://dev.perl.org/licenses/ for more information.