#!/usr/bin/perl -w use strict; use Tk; my $mw = tkinit(); my @werte = qw(1 2 3 4 5 6); my $listbox = $mw->Scrolled('Listbox', -scrollbars => 'e', -height => 5, -listvariable => \@werte, -exportselection => 1,) ->pack(-side => 'left', -fill => 'y',); $listbox->bind('<>', sub{check_state()} ); my $b1 = $mw->Button(-text => 'test')->pack; my $lb2 = $mw->Scrolled('Listbox', -scrollbars => 'e', -height => 5, -listvariable => \@werte,) ->pack(-side => 'left', -fill => 'y',); $lb2->bind('<>', sub{check_state()}); MainLoop; sub check_state { if ($listbox->curselection()) { $b1->configure( -state => "normal"); } else { $b1->configure( -state => "disabled" ); } }