I want to draw a line on a picture using perl and Tk. Here is what I have. I get to see the line, but not the graphic. If I don't create the canvas (and pack the image instead of placing it) I can see the image. What am I missing?
#! /usr/bin/perl -w
use strict;
use Tk;
my $mw = MainWindow->new(-title => "Try to put a line over an image" )
+;
$mw -> Photo ('imggif', -file => 'C:/foo.gif');
my $cf = $mw->Frame;
$cf->pack( -side => 'left', -fill => 'y', -expand => 1);
my $label = $cf->Label( -image => 'imggif');
# $label->pack( -side => 'left', -fill => 'both', -expand => 1);
$label->place( -anchor => 'nw', -relheight => 1,
-relwidth => 1, -x => 0, -y => 0);
my $c = $cf->Scrolled("Canvas", -cursor => 'crosshair', # was $mw->
-scrollbars => 'se')
->pack( -side => 'left', -fill => 'both', -expand => 1);
my $line = $c->createLine(0,0,100,100, -width => 2, -fill => "red");
MainLoop;
Thanks! --traveler