in reply to How to hide/show gif on click
Here's a piece of working Tk code that shows how to hide and show a widget (on the click of a button) using pack() and packForget().
#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow->new; my $f1 = $mw->Frame()->pack; my $f2 = $mw->Frame()->pack; my $l1 = $f1->Label(-text => 'Image here')->pack; $f2->Button(-text => 'Show', -command => sub { $f1->pack(-before => $f +2); })->pack; $f2->Button(-text => 'Hide', -command => sub { $f1->packForget; })->pa +ck; $f2->Button(-text => 'Quit', -command => sub { exit; })->pack; MainLoop;
-- Ken
|
|---|