Tk::CanvasLogo - a Tk::Canvas widget that can support methods based on the Logo Programming Language as well as multiple turtles.
use Tk; use CanvasLogo; my $top = MainWindow->new(); my $logo = $top->CanvasLogo->pack(); my $turtle = $logo -> NewTurtle; $turtle -> LOGO_FD(50); # forward 50 MainLoop();
The Tk::CanvasLogo widget is a regular Canvas widget that adds support to allow drawing on the canvas with Logo commands. The user first creates a CanvasLogo widget. Then using that widget, the user creates turtle objects which are attached to that CanvasLogo widget. Turtle objects can then execute Logo-based methods.
The following methods are currently supported.
$turtle->LOGO_FD(N); # move turtle forward N pixels
$turtle->LOGO_BK(N); # move turtle backward N pixels
$turtle->LOGO_RT(N); # turn turtle Right (clockwise) N degrees
$turtle->LOGO_LT(N); # turn turtle Left (counter clockwise) N degrees
$turtle->LOGO_PU; # turtle's "pen" up. moving turtle while pen up will not draw.
$turtle->LOGO_PD; # turtle's "pen" down. moving turtle while pen down will draw.
$turtle->LOGO_CS; # Clear screen. This will clear the turtle and everything it drew. It will not clear entire canvas. Use Canvas->delete('all') for that.
$turtle->LOGO_HOME; # move turtle to center of screen facing straight up.
None
http://en.wikipedia.org/wiki/Logo_programming_language
Greg London, http://www.GregLondon.com
Copyright (C) 2007 by Greg London
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install Tk::CanvasLogo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::CanvasLogo
CPAN shell
perl -MCPAN -e shell install Tk::CanvasLogo
For more information on module installation, please visit the detailed CPAN module installation guide.