#!/usr/bin/perl use warnings; use strict; use Tk; my ( $entry, $cbvalue ); my $mw = tkinit; $mw->Checkbutton( -text => 'Use Entry widget below?', -variable => \$cbvalue, -command => \&SetState, )->pack; $entry = $mw->Entry->pack; SetState(); MainLoop; sub SetState { $entry->configure( -state => $cbvalue ? 'normal' : 'disabled' ); }