Dear all.
I would like to link dynamically the textvariable of an Entry with the choice made in a BrowseEntry widget. I have tried the code below but changing the value of the BrowseEntry does not refresh the content of the following Entry as wanted.
I have also tried "bind" and "update" methods wihtout success. Any help would be much appreciated.
use strict;
use Tk;
use Tk::BrowseEntry;
my $AssignMet='\Input\0InputMeteo.txt';
my $AssignTmy='\Input\TMY2\FR-Trappes-71450.tm2';
my $type='Site';
my $simuTl = new MainWindow();
my $f0 = $simuTl->Frame();
my $l="Type de fichier m\xE9t\xE9o";
my $lb0 = $f0->BrowseEntry(
-label => $l,
-choices => ['Site','TMY2'],
-variable => \$type,
)->pack();
$f0->pack();
my $f1 = $simuTl->Frame();
my $l="Fichier de donn\xE9es m\xE9t\xE9o";
my $lab1 = $f1->Label(
-text => $l,
);
if ($type eq "Site") {
my $ent1 = $f1->Entry(-textvariable=>\$AssignMet);
$lab1->pack(-side => 'left');
$ent1->pack();
$f1->pack();
}
else {
my $ent1 = $f1->Entry(-textvariable=>\$AssignTmy);
$lab1->pack(-side => 'left');
$ent1->pack();
$f1->pack();
}
MainLoop;
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.