Debian Codegraph @

examples/font_test

raw
1 #!/usr/local/bin/perl -w
2
3
4
5 use Tk ;
6 $top = MainWindow->new;
7
8 chomp(@fonts = `xlsfonts`) ;
9
10 $list = $top->ScrlListbox(-scrollbars => 'e', -width => 70) ;
11 $list->pack(qw(-fill both -expand 1)) ;
12 $list->bind('<1>' => [sub {&changeFont} ] ) ;
13
14 grep ($list->insert('end',$_), @fonts) ;
15
16 MainLoop ;
17
18 sub changeFont {
19 local($w) = shift ;
20 local($fontName) ;
21 $fontName = $w->get($w->curselection) ;
22 $w->configure(-font => $fontName ) ;
23 }
24