Late-Night PerlTK Fun.

I’m just messing around with PerlTK tonight. Here’s my artistic accomplishment.

#!/usr/bin/perl -w

use strict;
use Tk;

my($width, $height) = (250,250);
my $x;
my $y;
my $mw = MainWindow->new;
my $c = $mw->Canvas(-width => $width, -height => $height);

$y = $height;

for ($x = 0; $x <= $width; $x+=10) {
	$c->createLine(0, $height-$y, $x, $height, -fill => 'blue');
	$c->createLine($width-$x, 0, $width, $y, -fill => 'black');
	$c->createLine($width-$x, 0, 0, $height-$y, -fill => 'red');
	$c->createLine($x, $height, $width, $y, -fill => 'green');


Which results in

PerlTK is refreshingly simple to use. I recommend to get yourself on your feet with a great tutorial.

Leave a Reply

Staypressed theme by Themocracy