in reply to Re^2: Perl-tk Entry
in thread Perl-tk Entry

erez_ez,
You really should use warnings. What I have does what you want, but is really a bad way of doing it - you should look at the advice from zentara. I only had a couple of minutes in between playing blocks with my 2 year old.
#/usr/bin/perl use strict; use warnings; use Tk; my $main = MainWindow->new; $main->minsize(qw(350 350)); $main->title("GUI"); $main->configure(); my $l_frame = $main->Frame()->pack(-side => 'left'); my ($checked, $entry); my $check_box = $l_frame->Checkbutton( -variable => \$checked, -command => sub { open_menu($checked, \$entry); } )->pack(); MainLoop; sub open_menu { my ($checked, $entry) = @_; if ($checked) { $$entry = $l_frame->Label( -text => 'enter your name: ', -background => 'white' ) if ! defined $$entry; $$entry->pack(); } else { $$entry->destroy; $$entry = undef; $main->update; } }

Cheers - L~R