Canvas class is used to create different shapes with the help of some functions which are defined under Canvas class. Any shape that Canvas class creates requires a canvas, so before creating any shapes a Canvas object is required and needs to be packed to the main window.
Canvas Methods for shapes:
Canvas.create_oval(x1, y1, x2, y2, options = …): It is used to create a oval, pieslice and chord.
Canvas.create_rectangle(x1, y1, x2, y2, options = …): It is used to create rectangle and square.
Canvas.create_arc(x1, y1, x2, y2, options = …) This is used to create an arc.
Canvas.create_polygon(coordinates, options = …) THis is used to create any valid shapes.
We are using a class to show the working of functions that helps to creates different shapes.
Class parameters –
Data members used: master, canvas
Member functions used:
Widgets used: Canvas
Tkinter method used:
Below is the Python code –
- Python Tkinter | Create different type of lines using Canvas class
- Calculating Areas Of Different Shapes Using Python
- Python | Drawing different shapes on PyGame window
- How to Create custom Turtle shapes in Python?
- Python Tkinter | Moving objects using Canvas.move() method
- Python Tkinter - Canvas Widget
- Draw geometric shapes on images using OpenCV
- Draw Color Filled Shapes in Turtle - Python
- Python | Create a digital clock using Tkinter
- Python | Create a GUI Marksheet using Tkinter
- Create a Yes/No Message Box in Python using tkinter
- Create MySQL Database Login Page in Python using Tkinter
- Create First GUI Application using Python-Tkinter
- Create Copy-Move GUI using Tkinter in Python
- Create Countdown Timer using Python-Tkinter
- Different messages in Tkinter | Python
- Create Table Using Tkinter
- Create a GUI to check Domain Availability using Tkinter
- Create a GUI to Get Domain Information Using Tkinter
- Create Air Canvas using Python-OpenCV
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.