Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to remove the outline of an oval in Tkinter?
With Tkinter canvas, we can draw shapes for 2D or 3D applications, create images, draw animations, and many more things. When creating an oval on the canvas, you might want to remove its outline for a cleaner aesthetic look. To remove the outline from shapes in the canvas, we can provide an empty string "" to the outline parameter in the drawing method.
Syntax
The create_oval() method accepts several parameters including outline ?
canvas.create_oval(x1, y1, x2, y2, fill="color", outline="")
Parameters
- x1, y1 − Top-left coordinates of the bounding rectangle
- x2, y2 − Bottom-right coordinates of the bounding rectangle
- fill − Interior color of the oval
- outline − Border color (use empty string to remove)
Example
Here's how to create an oval without an outline ?
# Import tkinter library
from tkinter import *
# Create an instance of tkinter frame or window
win = Tk()
# Set the geometry of tkinter frame
win.geometry("750x350")
# Create a canvas and an oval without outline
canvas = Canvas(win, width=400, height=350, bg="#458a4a")
canvas.create_oval(50, 50, 250, 250, fill="white", outline="")
canvas.pack()
win.mainloop()
Output
The above code displays a white oval without any border outline inside a green canvas ?
Comparison
| Parameter | With Outline | Without Outline |
|---|---|---|
outline |
"black" (default) |
"" (empty string) |
| Appearance | Oval with visible border | Oval with no border |
| Use Case | When border definition is needed | For clean, borderless shapes |
Conclusion
To remove an oval's outline in Tkinter, set the outline parameter to an empty string "" in the create_oval() method. This creates a clean, borderless oval that blends smoothly with the canvas background.
