Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Tk geometry, pixel coordinates precision, canvas and outline

by Discipulus (Canon)
on Apr 24, 2018 at 09:37 UTC ( [id://1213469]=note: print w/replies, xml ) Need Help??


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,
  • 1 yes with -highlightthickness => 0 as in your example everything is looking better. You set this on the main canvas and if I understand affects the frame where rectangles will be drown. But in effect this looks ok until -outline => undef is there. I'm starting to doubt that -outline => undef means a transparent outline: probably it means no outline at all so less pixel used.

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..

  • 2 Thanks i overlooked this part of the docs.. So I must always consider 1 pixel more while drawing rectangles, even with no outline.
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1213469]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-26 02:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found