Creating Round Buttons in Tkinter

Tkinter doesn’t natively support round buttons, but with a few creative techniques you can still design buttons with a circular shape. This is useful when building more modern or custom-styled interfaces.

Method 1: Using Canvas to Draw a Circular Button

One approach is to use the Canvas widget to draw an oval and bind a click event to it:

See also  GUI with autogenerated triangles

import tkinter as tk

def on_click(event):
    print("Round button clicked!")

root = tk.Tk()
root.geometry("200x200")

canvas = tk.Canvas(root, width=200, height=200)
canvas.pack()

# Draw a circle (oval with equal width and height)
circle = canvas.create_oval(50, 50, 150, 150, fill="skyblue", outline="")

# Add text on the circle
text = canvas.create_text(100, 100, text="Click", font=("Arial", 12))

# Bind click to both circle and text
canvas.tag_bind(circle, "", on_click)
canvas.tag_bind(text, "", on_click)

root.mainloop()

This gives you a clickable, round visual element with text inside.

Method 2: Using Images to Create a Round Button

If you want more advanced styling (e.g. gradients, icons), create a round button image (PNG with transparency) and use it as a button:

import tkinter as tk
from PIL import Image, ImageTk

def on_click():
    print("Image button clicked!")

root = tk.Tk()

# Load image (should be a circular PNG)
image = Image.open("round_button.png")
photo = ImageTk.PhotoImage(image)

button = tk.Button(root, image=photo, command=on_click, borderwidth=0)
button.pack(pady=20)

root.mainloop()

This method offers full control over appearance but requires image assets.

While Tkinter doesn’t directly support circular buttons, using a Canvas or PhotoImage lets you simulate them effectively. Both methods give you clickable interfaces with a more modern or playful appearance.