Here's how you code would look in order to do what I think you are trying to do (and this is how it looks when you put <code> and </code> tags around the script, as described in
Writeup Formatting Tips):
use Tk;
use strict;
my $mw = MainWindow->new;
$mw->configure(-title => 'Verify User',-background =>'blue');
$mw->geometry('+100+300');
my $name = ''; # declare a variable for the value of "name"
my $vu_frml = $mw->Frame(-relief=>'groove',
-borderwidth => 3,
-background =>'blue',
)->pack(-side => 'top', -fill => 'x');
my $vu_lb1 = $vu_frml->Label(-text =>'name',
-background=>'blue',
-foreground=>'white',
)->pack(-side=>'left');
# use that "name" variable with this Entry widget:
my $vu_enl = $vu_frml->Entry(-width =>9,
-textvariable => \$name,
-background => white'
)->pack(-side=>'left',-pady=>3);
$mw->Button( -background=>'blue',
-foreground=>'white',
-text => 'ok',
-command => sub { # use the variable again here:
$mw -> Label(-textvariable => \$name,
-font => "fixed", )-> pack;
}, )->pack(-side => 'top', -fill => 'x');
MainLoop;
The docs for both Tk::Label and Tk::Entry describe how the "-textvariable" attribute is used. It's very handy.
In reply to Re: perl tk
by graff
in thread perl tk
by caboose
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.