<?xml version="1.0" encoding="windows-1252"?>
<node id="578602" title="Tk::Entry not updating when textvariable changes." created="2006-10-16 17:53:36" updated="2006-10-16 13:53:36">
<type id="115">
perlquestion</type>
<author id="266955">
jdtoronto</author>
<data>
<field name="doctext">
Esteemed monks,&lt;p&gt;
In a Perl/Tk application I create a notebook, then a tab which I populate. One of the fields is a [mod://Tk::Entry] which is to get a file name. But when the variable gets updated, the value shown in the [mod://Tk::Entry] does not change on the screen. &lt;readmore&gt;Draw the notebook:
&lt;c&gt;
sub draw {
  my $self = shift;

  print "Notebook Page ", $self-&gt;{_nb};
  my $notebook = $self-&gt;{_nb}-&gt;parent();
  #$notebook-&gt;pageconfigure( 'page12', -raisecmd =&gt; sub { $self-&gt;_load_configs } );

  #notebook portion
  $self-&gt;{_subnb} = $self-&gt;{_nb}-&gt;NoteBook()-&gt;grid();

  $self-&gt;{subnb_p1} = $self-&gt;{_subnb}-&gt;add( 'page1', -label =&gt; 'Prepare email message' );
  $self-&gt;_draw_subnb_p1();
}
&lt;/c&gt;
then populate it:
&lt;c&gt;
sub _draw_subnb_p1 {
  my $self = shift;

  # FRAME - top left side

  $self-&gt;{subnb_p1}-&gt;Label( -text =&gt; 'Email Subject', )-&gt;grid(
    $self-&gt;{subnb_p1}-&gt;Entry(
      -width        =&gt; 50,
      -textvariable =&gt; \$::cini_global-&gt;{trickle}-&gt;{subject},
    ),
    -padx =&gt; 5,
    -pady =&gt; 5,
  );

  $self-&gt;{subnb_p1}-&gt;Label(
    -text  =&gt; 'Email template',
    -width =&gt; '12',
    )-&gt;grid(
    $self-&gt;{subnb_p1}-&gt;Entry(
      -width        =&gt; '50',
      -textvariable =&gt; \$::cini_global-&gt;{trickle}-&gt;{email_template_file}
    ),
    $self-&gt;{subnb_p1}-&gt;Button(
      -text    =&gt; 'Browse',
      -command =&gt; sub { $self-&gt;_getImportFile() },
    ),
    $self-&gt;{_edemail_button} = $self-&gt;{subnb_p1}-&gt;Button(
      -text    =&gt; 'Edit',
      -command =&gt; sub { $self-&gt;_edit_emailtemplate() },
    ),
    -padx =&gt; 5,
    -pady =&gt; 5,
    );

  my $top = $self-&gt;{subnb_p1}-&gt;Frame( -borderwidth =&gt; 2, -relief =&gt; 'raised' )-&gt;grid();
  $top-&gt;Button(
    -text    =&gt; 'Preview Email',
    -command =&gt; sub { $self-&gt;_preview_emailtemplate() },
    )-&gt;grid(
    $top-&gt;Button(
      -text    =&gt; 'Send Emails',
      -command =&gt; sub { $self-&gt;_send_emails() },
    ),
    -padx =&gt; 5,
    -pady =&gt; 5,
    );

}
&lt;/c&gt;

&lt;c&gt; $::cini_global &lt;/c&gt; is a global configuration hash whioch is populate using [mod://Config::IniHash]&lt;p&gt;
Now click on the button to change the file name and this gets called:
&lt;c&gt;
sub _getImportFile {
  my $self = shift;

  # Get the name of the file we are going to import
  my @types = ( [ "TMPL files", '.tmpl' ], [ "All Files", "*" ], );
  $::cini_global-&gt;{trickle}-&gt;{email_template_file} = $self-&gt;{_nb}-&gt;getOpenFile( -filetypes =&gt; \@types );
  if ( $::cini_global-&gt;{trickle}-&gt;{email_template_file} ) {
    $self-&gt;{_edemail_button}-&gt;configure( -state =&gt; 'normal' );
  }
  WriteINI( $::CONFIG_FILE, $::cini_global );
  print Dumper $::cini_global;
  $self-&gt;{_mw}-&gt;update();
}
&lt;/c&gt;
You will see as soon as I get the file name I write the config hash back to disk - just in case. I can see the file change when I look at it, but despite the fact that &lt;c&gt;$::cini_global-&gt;{trickle}-&gt;{email_template_file}&lt;/c&gt; has changed the display does not change! Am I doing something stupid here? Or is there a bug somewhere??
&lt;/readmore&gt;
&lt;p&gt;
[jdtoronto]</field>
</data>
</node>
