Hi, I am just starting with Tk and I'll admit, I don't get a chance to write a lot of Perl. But, this seems very simple to me so I can't figure out why it won't work.
my $text = "foo";
my $mw = MainWindow->new;
my $button = $mw->Button(-text=>'Change entry', -command=>\&change)->p
my $entry = $mw->Entry(-textvariable=>$text)->pack();
print "\$text before: $text\n";
$text = "bar";
print "\$text after: $text\n";
I assume I must be doing something really stupid because my entry never gets updated, but $text changes from the prints.
If I add
before the $mw->update() it works ok. However, all the documentation suggests if I use textvariable, changing the variable anywhere should magically update the widget text.
I searched around, but the similar problems I saw were much more complicated than this so I didn't get a lot of help from them.