my $canvas = $mw->Canvas(-width => '350', -height => '350', -bg => '#FFFFFF', ) ->pack(); $canvas->bind("<1>" => sub { my $e = $canvas->XEvent; my($x, $y) = ($canvas->canvasx($e->x), $canvas->canvasy($e->y)); $canvas->createLine($x, $y, ($x+50), ($y+50));