Bäume visualisieren mit Tk::TreeGraph

Bäume können mit Tk::TreeGraph visualisiert werden.


Perl-Quellcode

#!perl

use strict;
use warnings;
use utf8;
use Tk;
use Tk::TreeGraph;

my $mw = tkinit(-width=>800,-height => 800);
$mw->packPropagate(0);

my $tg = $mw->Scrolled('TreeGraph')->pack(-expand => 1, -fill => 'both');

my $tree_aref = [
	['root', [
		['S',[
			['NP', ['EN Béatrice']],
			['VP', [
				'VVFIN ist', 
				['NP', [
					'DET die',
					['PP', [
						'ADJA schönste',
						'NN Frau',
					]],
				]]
			]],
		]],
		'$ .'],
	],
];

$tg->draw_tree_from_ref( $tree_aref );

$mw->MainLoop();
exit(0);
Top