Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Widget Type

by Lhamo_rin (Friar)
on Jun 26, 2003 at 16:17 UTC ( [id://269288]=perlquestion: print w/replies, xml ) Need Help??

Lhamo_rin has asked for the wisdom of the Perl Monks concerning the following question:

Is there a widget in Tk that will display the value of a variable but allow the user to type in a new value, if desired, over the original value in the widget and have the new value saved to the variable?

Lhamo_rin

Replies are listed 'Best First'.
Re: Widget Type
by Tanalis (Curate) on Jun 26, 2003 at 16:28 UTC
    You can associate widgets with variables, and they'll take on the value of that variable.

    You probably need something like a LabEntry or an Entry widget (depending on what you're doing with it) - and you'd use it something like this:

    my $mw = new MainWindow(); my $text = "This is an entry box"; $entry = $mw->Entry(-textvariable => \$text)->pack();
    That'll give you a text entry box, containing the text in $text, and allow you to change the text. Anything the user enters will automatically be stored in the $text variable.

    Hope that helps.
    -- Foxcub
    #include www.liquidfusion.org.uk

    Edit: Corrections/clarifications.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://269288]
Approved by Thelonius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2024-04-25 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found