#!/usr/bin/perl -w use strict ; use Tk ; # window's initialisation $mw = new MainWindow ; $img = 'example.xpm' ; { not really exist sur ! } #A button $bttn = $mw->Button(-image=>$img, -command=>\&clicked)->pack(-side=>'top'); sub clicked { if $bttn->configure(-image) eq 'example.xpm') { $bttn->configure(-image=>'example2.xpm'); } else { $bttn->configure(-image=>'example.xpm'); } } MainLoop;