#!/usr/bin/perl -w use strict; use Tk; use Tk::HList; use Tk::ItemStyle; use Tk::Label; my $mw = MainWindow->new(); my $label = $mw->Label(-width=>15); my $hlist = $mw->HList( -itemtype => 'text', -separator => '/', -selectmode => 'single', -browsecmd => sub { my $file = shift; $label->configure(-text=>$file); } ); my %priorities = ( 1 => { text => 'Highest', colour => 'red' }, 2 => { text => 'High', colour => 'orange' }, 3 => { text => 'Medium', colour => 'darkgreen' }, 4 => { text => 'Low', colour => 'blue' }, ); for my $int (1..4){ $priorities{$int}->{style} = $hlist->ItemStyle('text', -foreground => $priorities{$int}->{colour}, -background => 'white', -selectbackground => '#0A246A', -selectforeground => 'white', ); } foreach ( qw(/ /home /home/ioi /home/foo /usr /usr/lib) ) { $hlist->add($_, -text=>$_, -style=>$priorities{1}->{style}); } $hlist->pack; $label->pack; MainLoop;