Tkinter: how to colorize the outline of a canvas rectangle?

From the page you linked:

outline=
Outline color. Default is “black”.


By default, the interior of a rectangle is empty, and you can also get this behavior with fill='' rather than just leaving it out.

If you want the rectangle outlined, just add a keyword argument named outline to the create_rectangle() call:

rect = canvas.create_rectangle(20,20, 1, 1, outline='red')

You can also control the width of the border by also adding a width=xxx keyword argument to the call. The default width is 1 pixel.