Bonjour,

j'utilise Active Perl 5.10 pour compiler un petit exemple de "hello world !" avec Tk qui affiche une image comme étant un bouton.

voila l'exemple :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
#!/usr/bin/perl
use Tk;
$main = MainWindow->new();
$main->title("Hello World!");
$label = $main->Label(-text => 'Hello from Tk!');
$button = $main->Button();
$icon = $button->Photo(-file => "icon.gif" );
 
$button->configure(image => $icon,
command => sub { exit; }
);
$label->pack(side => 'left');
$button->pack(side => 'left',
padx => 5
);
MainLoop();
Mais, j'ai eu cette trace :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
 @ 535 not utf8
SV = PV(0x1bc58dc) at 0x1c0f21c
  REFCNT = 1
  FLAGS = (POK,pPOK,UTF8)
  PV = 0x1bff98c "couldn't recognize data in image file \"\334\201\301\1\1\""\0 [UTF8 "couldn't recognize data in image file "\x{701}A\x{1}""]
  CUR = 45
  LEN = 48
SV = PV(0x1bc58dc) at 0x1c0f21c
  REFCNT = 1
  FLAGS = (POK,pPOK,UTF8)
  PV = 0x1bff98c "couldn't recognize data in image file \"\334\201\301\1\1\""\0 [UTF8 "couldn't recognize data in image file "\x{701}A\x{1}""]
  CUR = 45
  LEN = 48
couldn't recognize data in image file "???" at C:/Perl/site/lib/Tk/Image.pm line 21.
Comment résoudre ce problème?

Merci d'avance