Canvas.create_line() method is used to create lines in any canvas. These lines can only be seen on canvas so first you need to create a Canvas object and later pack it to the main window.
Canvas.create_line(x1, y1, x2, y2, ...., options = ...)
Note: Minimum 4 points are required to create a line, but you can also add multiple points to create different drawings.
Class paramaters –
Data members used:
Member functions used for the given class: create() method
Widgets used: Canvas
Tkinter method used:
Below is the Python code –
- Python Tkinter | Create different shapes using Canvas class
- Python Tkinter | Moving objects using Canvas.move() method
- Python | Create a digital clock using Tkinter
- Python Tkinter | Create LabelFrame and add widgets to it
- How to create a list of object in Python class
- Python GUI - tkinter
- RadioButton in Tkinter | Python
- Python | after method in Tkinter
- Different messages in Tkinter | Python
- resizable() method in Tkinter | Python
- Python | PanedWindow Widget in Tkinter
- Python | Binding function in Tkinter
- Python | askopenfile() function in Tkinter
- minsize() method in Tkinter | Python
- Python | grid() method in Tkinter
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.