stickleback has asked for the wisdom of the Perl Monks concerning the following question:
The -textvariable substitution in the third map statement above doesn't do what I hoped, i.e., set up the link to the associated variable. Instead it seems to just place the quoted text into the Entry field. What am I missing?#/usr/bin/perl use warnings; use strict; use Tk; use Tk 800.000; use Tk::Dialog; my $user = "Hello"; my $password = "World"; my $mw = MainWindow->new(); my $dlgLDL = $mw->Dialog( -title=>'Login', -buttons=>['Ok','Cancel'], -default_button=>'Ok'); my ($fLeft,$fRight) = map {$dlgLDL->Frame(-padx=>4,-borderwidth=>0,-relief=>'groove')- +>pack(-side=>$_,-pady=>5)} qw/left left/; my ($l1,$l2) = map {$fLeft->Label( -text => $_, -anchor=>'e', -width=>12)->pack +(-side=>'top',-pady=>3)} qw/User: Password: /; my ($dfHost, $dfPort, $dfUser,$dfPassword) = map {$fRight->Entry( -textvariable=>$_ )->pack(-side=>'top',- +pady=>3)} qw/\$user \$password/; my $selected = $dlgLDL->Show(); MainLoop;
Please note this may be a very simple mistake as I am still trying to pick up basic Perl syntax.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk with map - Perl newbie
by vkon (Curate) on Mar 31, 2011 at 13:40 UTC | |
by stickleback (Novice) on Mar 31, 2011 at 13:56 UTC | |
by vkon (Curate) on Mar 31, 2011 at 19:20 UTC | |
by Marshall (Canon) on Apr 02, 2011 at 19:22 UTC | |
|
Re: Tk with map - Perl newbie
by Sinistral (Monsignor) on Mar 31, 2011 at 15:12 UTC | |
by stickleback (Novice) on Mar 31, 2011 at 15:18 UTC | |
by gnosti (Chaplain) on Mar 31, 2011 at 18:19 UTC | |
by Sinistral (Monsignor) on Apr 04, 2011 at 13:57 UTC | |
|
Re: Tk with map - Perl newbie
by Anonymous Monk on Mar 31, 2011 at 13:41 UTC |