Open In App

How to make Rounded buttons in Tkinter

Last Updated : 17 Dec, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

Tkinter is a Python module that is used to create GUI (Graphical User Interface) applications with the help of a variety of widgets and functions. Like any other GUI module, it also supports images i.e you can use images in the application to make it more attractive.

In this article, we will discuss How to make a Rounded Button in Tkinter, There is no in-built method to make rounded buttons in Tkinter. For making the button rounded we will define borderwidth value to zero

borderwidth: It will represent the size of the border around the label. By default, borderwidth is 2 pixels. “bd” can also be used as a shorthand for borderwidth.

Step-by-step implementation:

Step 1: Create a Normal Tkinter Window.

Python3




# Import module
from tkinter import *
  
# Create object
root = Tk()
  
# Adjust size
root.geometry("400x400")
  
# Execute tkinter
root.mainloop()


Output:

Step 2: Add button and image.

Python3




# Add Image
login_btn = PhotoImage(file = "Image Path")
  
# Create button and image
img = Button(root, image = login_btn,
             borderwidth = 0)
  
img.pack()


Output:

Below is the full implementation:

Python3




# Import Module
from tkinter import *
  
# Create Object
root = Tk()
  
# Set geometry
root.geometry("400x400")
  
# Add Image
login_btn = PhotoImage(file = "Image Path")
  
# Create button and image
img = Button(root, image = login_btn,
             borderwidth = 0)
  
img.pack()
  
# Execute Tkinter
root.mainloop()


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads