#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = new MainWindow(-title =>"Test"); my $windowheight = 360; my $windowwidth = 470; my $mframe = $mw->Frame(); my $textfield1 = $mframe->ScrlListbox(-scrollbars =>"se", -height => 10, -width => 35); my $button_start = $mframe->Button(-text =>"Start", -command=>\&start); my $button_stop = $mframe->Button(-text =>"Stop", -state => "disabled", -command=>\&stop); my $button_clear = $mframe->Button(-text =>"Clear", -command=>\&clear); my $lframe = $mw->Frame(); my $textfield2 = $lframe->ScrlListbox(-scrollbars=>"se", -height => 6, -width => 62); $mframe->grid(-row=>1, -column=>1, -rowspan=>10, -columnspan=>4); $textfield1->grid(-row=>1, -column=>1, -rowspan=>10); $button_start->grid(-row=>1, -column=>2); $button_stop->grid(-row=>2, -column=>2); $button_clear->grid(-row=>3, -column=>2); $lframe->grid(-row=>11, -column=>1, -rowspan=>2, -columnspan=>2); $textfield2->grid(-row=>1, -column=>1, -rowspan=>1, -columnspan=>1); # disable / enable check fuer stop button $textfield1->bind('<>', sub { if ($textfield1->curselection()) { $button_stop->configure( -state => "normal"); } else { $button_stop->configure( -state => "disabled"); } } );