Draw a circle in using Tkinter Python

Tkinter Canvas widget provides built-in methods for creating various shapes including circles, rectangles, triangles, and freeform shapes. To draw a circle, we use the create_oval() method with specific coordinates.

Syntax

The basic syntax for creating a circle using create_oval() method is ?

canvas.create_oval(x0, y0, x1, y1, options)

Parameters

  • x0, y0 ? Top-left corner coordinates of the bounding rectangle
  • x1, y1 ? Bottom-right corner coordinates of the bounding rectangle
  • options ? Additional styling options like fill, outline, width

Example − Basic Circle

Here's how to create a simple circle using the create_oval() method ?

# Import the library
from tkinter import *

# Create an instance of tkinter frame
win = Tk()

# Define the geometry of window
win.geometry("600x400")

# Create a canvas object
c = Canvas(win, width=400, height=400)
c.pack()

# Draw a circle in the canvas
c.create_oval(60, 60, 210, 210)

win.mainloop()

The output displays a black circle with coordinates (60,60) as top-left and (210,210) as bottom-right of the bounding rectangle.

Example − Styled Circle

You can customize the circle's appearance using various options ?

from tkinter import *

win = Tk()
win.geometry("600x400")
win.title("Styled Circle")

canvas = Canvas(win, width=400, height=400, bg="white")
canvas.pack()

# Create a filled circle with custom colors
canvas.create_oval(100, 100, 300, 300, 
                   fill="lightblue", 
                   outline="blue", 
                   width=3)

# Create a smaller circle
canvas.create_oval(150, 50, 250, 150, 
                   fill="red", 
                   outline="darkred", 
                   width=2)

win.mainloop()

This creates two circles with different colors, fills, and border styles.

Key Points

  • To create a perfect circle, ensure the width and height of the bounding rectangle are equal
  • The create_oval() method draws an ellipse that fits within the specified rectangle
  • Use fill option to set the interior color and outline for the border color
  • The width parameter controls the thickness of the circle's outline

Conclusion

Drawing circles in Tkinter is straightforward using the create_oval() method. Ensure equal dimensions for perfect circles and use styling options to customize appearance.

Updated on: 2026-03-25T18:30:22+05:30

18K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements