TkInter: draw one pixel
2 answers
To create a single pixel with coordinates x, y
on the canvas, you can use an object rectangle
:
canvas.create_rectangle( (x, y)*2 )
By default, a rectangle object has a one-pixel-wide black border, which, when one pixel wide, will only be black, regardless of color. To give the pixel the color you want, you can use outline=""
to then specify the color fill
.
I prefer this method as you only need to provide the coordinates x, y
, it is not required x+1
.
0
source to share