#!/usr/bin/perl -w ###################################################################### # (c) Michael Schilli 1999 ###################################################################### use Tk; use strict; my $top = MainWindow->new(); my $frame = $top->Frame(); my $text = $frame->Text(-wrap => 'none', -font => '*helvetica-bold-r-*12*'); my $labelvar = ""; my $label = $top->Label(-textvariable => \$labelvar); my $yscrollbar = $frame->Scrollbar(-command => [yview => $text]); my $xscrollbar = $top->Scrollbar(-orient => 'horizontal', -command => [xview => $text]); $text->configure(-yscrollcommand => [set => $yscrollbar]); $text->configure(-xscrollcommand => [set => $xscrollbar]); ### Alles packen $yscrollbar->pack(-side => 'right', -fill => 'y'); $xscrollbar->pack(-side => 'bottom', -fill => 'x'); $label->pack(-expand => 'yes', -fill => 'x', -side => 'bottom'); $frame->pack(-expand => 'yes', -fill => 'both'); $text->pack(-expand => 'yes', -fill => 'both', -side => 'left'); open(FONTS, "xlsfonts |") || die "xlsfonts: not found"; my $i=1; while() { next unless /--12/; # Nur Fonts der Größe 12 chop(my $font = $_); $text->insert("end", $_); # Text in Text-Widget einfügen # (mit \n) # Tag definieren und Font # dort setzen $text->tag("add", $i, "$i.0", sprintf("%d.0", $i+1)); $text->tag("configure", $i, -font => $font); $text->update(); $i++; $labelvar="Fonts: $i"; } close(FONTS); MainLoop;