Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Esteemed monks,

In a Perl/Tk application I create a notebook, then a tab which I populate. One of the fields is a Tk::Entry which is to get a file name. But when the variable gets updated, the value shown in the Tk::Entry does not change on the screen.

Draw the notebook:
sub draw { my $self = shift; print "Notebook Page ", $self->{_nb}; my $notebook = $self->{_nb}->parent(); #$notebook->pageconfigure( 'page12', -raisecmd => sub { $self->_load +_configs } ); #notebook portion $self->{_subnb} = $self->{_nb}->NoteBook()->grid(); $self->{subnb_p1} = $self->{_subnb}->add( 'page1', -label => 'Prepar +e email message' ); $self->_draw_subnb_p1(); }
then populate it:
sub _draw_subnb_p1 { my $self = shift; # FRAME - top left side $self->{subnb_p1}->Label( -text => 'Email Subject', )->grid( $self->{subnb_p1}->Entry( -width => 50, -textvariable => \$::cini_global->{trickle}->{subject}, ), -padx => 5, -pady => 5, ); $self->{subnb_p1}->Label( -text => 'Email template', -width => '12', )->grid( $self->{subnb_p1}->Entry( -width => '50', -textvariable => \$::cini_global->{trickle}->{email_template_fil +e} ), $self->{subnb_p1}->Button( -text => 'Browse', -command => sub { $self->_getImportFile() }, ), $self->{_edemail_button} = $self->{subnb_p1}->Button( -text => 'Edit', -command => sub { $self->_edit_emailtemplate() }, ), -padx => 5, -pady => 5, ); my $top = $self->{subnb_p1}->Frame( -borderwidth => 2, -relief => 'r +aised' )->grid(); $top->Button( -text => 'Preview Email', -command => sub { $self->_preview_emailtemplate() }, )->grid( $top->Button( -text => 'Send Emails', -command => sub { $self->_send_emails() }, ), -padx => 5, -pady => 5, ); }
 $::cini_global is a global configuration hash whioch is populate using Config::IniHash

Now click on the button to change the file name and this gets called:

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->{trickle}->{email_template_file} = $self->{_nb}->get +OpenFile( -filetypes => \@types ); if ( $::cini_global->{trickle}->{email_template_file} ) { $self->{_edemail_button}->configure( -state => 'normal' ); } WriteINI( $::CONFIG_FILE, $::cini_global ); print Dumper $::cini_global; $self->{_mw}->update(); }
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 $::cini_global->{trickle}->{email_template_file} has changed the display does not change! Am I doing something stupid here? Or is there a bug somewhere??

jdtoronto


In reply to Tk::Entry not updating when textvariable changes. by jdtoronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (8)
    As of 2014-07-13 19:27 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (251 votes), past polls