TkInter: draw one pixel
After creating a Canvas
object, you can draw a line that spans a single pixel.
your_canvas_widget.create_line(x, y, x + 1, y)
To create a single pixel with co-ordinates x, y
on a canvas, you can use a rectangle
object:
canvas.create_rectangle( (x, y)*2 )
By default, the rectangle object has a one-pixel wide black border, which when one-pixel wide will just be black, regardless of the colour. To give the pixel your desired colour, you can use outline=""
, so you can then specify your fill
colour.
I prefer this method as you only need to provide the x, y
co-ordinates, no x+1
is needed.