One of the most basic actions you can perform with a canvas is drawing segments from one point to another. Although it is possible to directly draw polygons using other methods, the create_line method of the Canvas class has enough options to understand the basics of displaying items.
Drawing lines and arrows
Getting ready
In this recipe, we will build an application that allows us to draw lines by clicking on the canvas. Each line will be displayed by clicking first on the point that will determine the line start, and a second time to set the line end.
We will be also able to specify some appearance options, such as color and width: