If you want to change the picture, then do
$button->configure(-image => $photo_object);
where $photo_object is constructed with $mw->Photo or $mw->Pixmap. And do not forget to delete unused photo objects, otherwise you'll got a memory leak.
Another alternative is to change the filename in the photo object:
#!/usr/bin/perl
use Tk;
$mw = tkinit;
$p = $mw->Photo(-file => Tk->findINC("Xcamel.gif"));
$b = $mw->Button(-image => $p,
-command => sub {
$p->configure(-file => Tk->findINC("openfolder.xpm"));
})->pack;
MainLoop;
|