I assume the user inputs a search string in some tk widget like an entry widget? So what you need to do is just create a subroutine that calls the "configure" widget option for all the labels or other widgets that your created so far.
for example:
#!/usr/local/bin/perl
use Tk;
my $mw = MainWindow->new();
$button = $mw->Button(-text => "hello", -activebackground => 'red',
-command => \&printit)->pack();
MainLoop;
sub printit {
$button->configure(-text => "you pressed me");
}
Justin Eltoft
| [reply] [d/l] |
I'm not entirely sure what you're asking. If you want Perl/Tk to redraw a widget (that you've changed somehow behind the scenes), just do this:
$widget->update();
If you're processing and want Tk to be responsive (redraws, respond to events, etc...) during that processing, then call idletasks on the top-level widget in your processing loop:
$mainwindow->idletasks();
| [reply] [d/l] [select] |
You should keep in mind that once you draw all widgets on the screen,
you have to assign actions to buttons and bind the output to other
widgets. If you define a button which should take an action,
you should return the result in (for example) a labelwidget, like:
(note: I can't test where I am now, so this code is not tested!)
#!/usr/bin/perl -w
use strict;
use Tk;
my $mainwindow = MainWindow->new();
my $label = $mainwindow->Label(-text => "This is before you press the
+button") ->pack();
my $button = $mainwindow->Button( -text => "press to change the lab
+el",
-command => sub {
$label->configure(-text => "This changed t
+he label")
}
)->pack();
MainLoop();
I hope this clarifies it...
Jouke Visser, Perl 'Adept'
Using Perl to help the disabled: pVoice and pStory
| [reply] [d/l] |