How to Change Background Color of a Tkinter Button in Python
In this tutorial, we are going to see how to change the background color of a Tkinter Button in Python. You are able to change the background color of a button in Python by defining the “bg” property of the Tkinter button to a color string or HEX value.
Assign a standard color or a hexadecimal RGB value to the “bg” property as shown below.
Example 1: Change Background Color of a Tkinter Button
from tkinter import *
gui = Tk()
gui.geometry('200x100')
btn = Button(gui, text = 'Click here!', bg='yellow')
btn.pack()
gui.mainloop()
Output:

Example 2: Change Background Color of a Tkinter button to hexadecimal color
from tkinter import *
gui = Tk()
gui.geometry('200x100')
btn = Button(gui, text = 'Click here!', bg='#96c0eb')
btn.pack()
gui.mainloop()
Output:

Example 3: Change Background Color of a Tkinter button to black
from tkinter import *
gui = Tk()
gui.geometry('200x100')
btn = Button(gui, text = 'Click here!', bg='black', fg='white')
btn.pack()
gui.mainloop()
Output:





