NAME
Tk::GraphItems - Display relation-graphs on a Tk::Canvas
DESCRIPTION
Tk::GraphItems provides objects 'TextBox' and 'Connector' to display nodes and edges of relation-graphs on a Tk::Canvas widget. Nodes can be dragged or moved programmaticaly hereby updating the positions of their dependent 'Connectors'.
SEE ALSO
Documentation of Tk::GraphItems::Connector and Tk::GraphItems::TextBox. Examples in Tk/GraphItems/Examples.
Example
use strict;
use warnings;
use Tk;
require Tk::GraphItems::TextBox;
require Tk::GraphItems::Connector;
my $mw = tkinit();
my $s_can = $mw -> Scrolled('Canvas',
-scrollregion=>[0,0,200,700],
)->pack(-fill =>'both',
-expand=>1);
my $can = $s_can->Subwidget('scrolled');
my @nodes;
my ($x,$y) = (50,20);
for my $n(0..4){$nodes[$n] = Tk::GraphItems::TextBox->new(canvas=>$can,
text=>"object $n",
'x'=>$x=($x%200)+40,
'y'=>$y+=100);
}
for my $n(0..4){Tk::GraphItems::Connector->new(
source=>$nodes[$n],
target=>$nodes[($n+1)%5],
);
}
MainLoop;
AUTHOR
Christoph Lamprecht, ch.l.ngre@online.de
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Christoph Lamprecht
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.7 or, at your option, any later version of Perl 5 you may have available.