in reply to Re: Tk geometry, pixel coordinates precision, canvas and outline
in thread Tk geometry, pixel coordinates precision, canvas and outline

Thanks master tybalt89 for your insights,

Compare difference if you comment/uncomment -outline => undef in the following snippet:

use Tk; my $mw = Tk::MainWindow->new(); my $can = $mw->Canvas( -height => 100, -width => 100 , -bg => 'red', -highlightthickness => 0, )->pack( ); $can->createRectangle(0,0,101,101, -fill => 'gold2', #-outline => undef , #-width => 10, ); MainLoop;

With #-outline => undef , the black, 1px outline is shown in North and West sides but no in other ones. This seems to prove that the outline width is added to. By other hand with -outline => undef no red background in shown so the yellow square fills the correct 100x100 region.

The weird part is that it seems that just first pixel is managed in this way, ie shifting the yellow square toward SE: infact using -width => 10 (the width of the outline!) the yellow square remains centerd..

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.