Joubarbe wrote: Thu Apr 10, 2025 10:52 amI don't quite understand why LineXY (the first one at the top) is overflowing of 1 pixel.
I didn't run your code but I have an explanation.
Box() uses width and height. Box(10, 10, 200, 200, #Black)
Box width of 200 covers pixels from its left at 10 to its right at 209 (i.e 10 + 200 -1).
Box height of 200 covers pixels from its top at 10 to its bottom at 209 (i.e 10 + 200 -1).
The LineXY() uses coordinates. LineXY(10, 100, 210, 100, #Black)
The line starts at (10, 100) and continues through (210, 100).
The line's rightmost coordinate is 210 while the box's is 209.
Line() also used width and height parameters. Line(10, 150, 200, 1, #Black)
This line starts at (10, 150) and continues through (209, 150) which is calculated as (10 + 200 -1, 150 + 1 - 1).
This line lines up with the box's dimensions.
The key take away is to remember that the width and height parameters include the starting point so you have to subtract that point to get the resulting coordinate. This also applies to other things that also use location and width and height parameters such as gadgets.