The program open a window with a entry box in which it is possible to put in values. The value in the box is printed in the console when the button "print" is clicked. Now I wonder if it is possible to preset a default value in the entry box so that there alredy is a value in the window when the program is started. (Which could could then be changed to something else.) Thank you for any help.#!/usr/bin/perl -w use Tk; use strict; my $mw = MainWindow->new; $mw->Label(-text => 'Number')->pack; my $nmbr = $mw->Entry(-width => 10); $nmbr->pack; $mw->Button( -text => 'Print', -command => sub{do_print($nmbr);} )->pack; MainLoop; sub do_print { (my $nmbr) = @_; my $nmbr_val = $nmbr->get; print "Printing number $nmbr_val\n"; }
In reply to How do I preset values in an entry-box? by tamaguchi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |