The themed widgets are in 'themed Tk' aka ttk.

import tkinter as tk
import tkinter.ttk as ttk

root = tk.Tk()
ok = ttk.Button(root, text='OK')
ok.pack()
root.mainloop()

Avoid from tkinter import * as both tkinter and tkinter.ttk define Button and many other widgets.

If you use this on Windows you should get something looking like a native button. But this is a theme and can be changed. On Linux or MacOS you will get a button style that is appropriate to that platform.

Answer from patthoyts on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-add-style-to-tkinter-button
Python | Add style to tkinter button - GeeksforGeeks
August 31, 2021 - Below code will be adding style to only selected Buttons i.e, only those buttons will get changed in which we will be passing style option. Code #1: ... # Import Required Module from tkinter import * from tkinter.ttk import * # Create Object root = Tk() # Set geometry (widthxheight) root.geometry('100x100') # This will create style object style = Style() # This will be adding style, and # naming that style variable as # W.Tbutton (TButton is used for ttk.Button).
๐ŸŒ
Python Assets
pythonassets.com โ€บ posts โ€บ styling-widgets-in-tk-tkinter
Styling Widgets in Tk (tkinter) | Python Assets
February 14, 2024 - A style is a class that contains information about the appearance of a type of a widget. In order for a particular widget to receive the appearance of a style, you must indicate the name of the style when creating the widget.
๐ŸŒ
TkDocs
tkdocs.com โ€บ tutorial โ€บ styles.html
TkDocs Tutorial - Styles and Themes
To use a style means to apply that style to an individual widget. All you need is the style's name and the widget to apply it to. Setting the style can be done at creation time: b = ttk.Button(parent, text='Hello', style='Fun.TButton')
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ tkinter.ttk.html
tkinter.ttk โ€” Tk themed widgets
Query or set the default value of the specified option(s) in style. Each key in kw is an option and each value is a string identifying the value for that option. For example, to change every default button to be a flat button with some padding and a different background color: from tkinter import ttk import tkinter root = tkinter.Tk() ttk.Style().configure("TButton", padding=6, relief="flat", background="#ccc") btn = ttk.Button(text="Sample") btn.pack() root.mainloop()
๐ŸŒ
Python GUIs
pythonguis.com โ€บ tutorials โ€บ getting started with tkinter โ€บ create buttons in tkinter
Button Widgets in Tkinter
July 13, 2022 - In this tutorial you have learned how to create buttons in Tkinter applications. You've added these buttons to your UI and then hooked them up to handler methods to make things happen. You have also learned how to customize the appearance of the buttons by adding images.
๐ŸŒ
15. The Menu widget
anzeljg.github.io โ€บ rin2 โ€บ book2 โ€บ 2405 โ€บ docs โ€บ tkinter โ€บ ttk-Button.html
29. ttk.Button
Here are the options for the ttk.Button widget. Compare these to the Tkinter version discussed in Section 7, โ€œThe Button widgetโ€.
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ tkinter tutorial โ€บ ttk styles
How to Use and Customize ttk Style By Practical Examples
January 5, 2021 - The following program shows how to change the font of all the Label and Button widgets by modifying the TLabel and TButtonโ€˜s styles: import tkinter as tk from tkinter import ttk class App(tk.Tk): def __init__(self): super().__init__() self.geometry('300x110') self.resizable(0, 0) self.title('Login') # UI options paddings = {'padx': 5, 'pady': 5} entry_font = {'font': ('Helvetica', 11)} # configure the grid self.columnconfigure(0, weight=1) self.columnconfigure(1, weight=3) username = tk.StringVar() password = tk.StringVar() # username username_label = ttk.Label(self, text="Username:") userna
Find elsewhere
๐ŸŒ
Readthedocs
tkinterttkstyle.readthedocs.io โ€บ en โ€บ latest โ€บ simple โ€บ button-style.html
Button - Style โ€” 'Putting on the Style' 2 documentation
Use the button widget as our first example and run the following queries interactively in Python. ... >>>import ttk >>>St = ttk.Style() # Style is used to call the classic theme >>>St.theme_use('classic') # step 1 using the widget name of *Button* >>>but = ttk.Button(None, text='Righto') # step 2 >>>butClass = but.winfo_class() # find the class name using the Button handle "but" >>>butClass TButton
๐ŸŒ
ttkbootstrap
ttkbootstrap.readthedocs.io โ€บ en โ€บ version-0.5 โ€บ widgets โ€บ button.html
Button โ€” ttkbootstrap documentation - Read the Docs
This guide will show you how to apply visual styles to change the look and feel of the widget. For more information on how to use the widget and what options are available, consult the reference section on widgets. The ttk.Button includes the TButton, Outline.TButton, and Link.TButton style classes.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ add-style-to-python-tkinter-button
Add style to Python tkinter button
Here are some commonly used style properties for buttons ? from tkinter import * from tkinter.ttk import * root = Tk() root.geometry('300x200') style = Style() # Configure a comprehensive button style style.configure('Custom.TButton', font=('Arial', 12, 'bold'), foreground='white', background='blue', padding=10, relief='raised', borderwidth=2) custom_btn = Button(root, text='Styled Button', style='Custom.TButton') custom_btn.pack(pady=20) root.mainloop()
Top answer
1 of 4
4

So configuring a buttons colors is a bit different when using tkinter button VS a ttk style button.

For a tkinter button you would use the background = "color" argument like the following:

button1 = Button( rootWindow, text="Change Label",
                      background = 'black', foreground = "white", command=change)

For a ttk button you would configure the style and then use the style = "style name" argument like the following.

style = ttk.Style()
style.configure("BW.TLabel", foreground="white", background="black")

buttonTTK = ttk.Button( rootWindow, text="TTK BUTTON",style = "BW.TLabel", command=change)

More information on ttk configs can be found here

from tkinter import *
from tkinter import ttk

def change():
    print("change functon called")

def main():
    rootWindow = Tk()

    label = ttk.Label( rootWindow, text="Hello World!",
                       background = 'black', foreground = "white")
    label.pack()

    button1 = Button( rootWindow, text="Change Label",
                          background = 'black', foreground = "white", command=change)
    button1.pack()

    style = ttk.Style()
    style.configure("BW.TLabel", foreground="white", background="black")

    buttonTTK = ttk.Button( rootWindow, text="TTK BUTTON",style = "BW.TLabel", command=change)
    buttonTTK.pack()

    rootWindow.mainloop()

main()

Result:

2 of 4
2

On Windows 10, I have run into the same problem, and have found a solution, although not a very satisfying one. The following will create a black button with white foreground type:

First define a custom button style based on the standard TButton style

mystyle = ttk.Style()
mystyle.configure('mycustom.TButton',background='black',foreground='white')

Then create the button using the new custom style

mybutton = ttk.Button(root,style='mycustom.Tbutton')

I say 'not very satisfying' because this only works if I have previously set the overall theme to 'default' as follows:

mystyle = ttk.Style()
mystyle.theme_use('default')

Using any of the other themes available on my system (winnative,clam,alt,classic,vista and xpnative) will change only the border to black, and leave the background grey.

๐ŸŒ
Python Guides
pythonguides.com โ€บ python-tkinter-button
How To Create Buttons In Python With Tkinter?
March 19, 2025 - The resulting button will have a blue background, white text, Arial font with size 14, a width of 10 characters, a height of 2 lines, 10 pixels of horizontal padding, 5 pixels of vertical padding, and a raised border style. ... The primary purpose of buttons is to trigger specific actions or ...
๐ŸŒ
TutorialKart
tutorialkart.com โ€บ python โ€บ tkinter โ€บ button
Python Tkinter Button
February 3, 2025 - Clicking the button prints Button clicked! in the console. Adding styling options such as background color, text color, and font. ... import tkinter as tk root = tk.Tk() root.title("Styled Button - tutorialkart.com") root.geometry("400x200") ...
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ tk_button.htm
Tkinter Button
You can attach a function or a method to a button which is called automatically when you click the button. Here is the simple syntax to create this widget โˆ’ ... options โˆ’ Here is the list of most commonly used options for this widget. These options can be used as key-value pairs separated by commas. Following are commonly used methods for this widget โˆ’ ... from tkinter import * from tkinter import messagebox top = Tk() top.geometry("100x100") def helloCallBack(): msg=messagebox.showinfo( "Hello Python", "Hello World") B = Button(top, text ="Hello", command = helloCallBack) B.place(x=50,y=50) top.mainloop()
๐ŸŒ
Python Tutorial
pythontutorial.net โ€บ home โ€บ tkinter tutorial โ€บ tkinter button
Tkinter Button - Python Tutorial
April 3, 2025 - In this tutorial, you'll learn about the Tkinter Button widget and how to use it to create various kinds of buttons.
๐ŸŒ
Tkinter
tkinter.com โ€บ modern-buttons-in-customtkinter-tkinter-customtkinter-2
Modern Buttons In CustomTkinter โ€“ Tkinter CustomTkinter 2 โ€“ TKinter.com
August 15, 2023 - You have many more attributes that allow you to customize the button in many way, and weโ€™ll talk about all of them in this video. ... from tkinter import * import customtkinter # Set the theme and color options customtkinter.set_appearance_mode("dark") # Modes: system (default), light, dark customtkinter.set_default_color_theme("dark-blue") # Themes: blue (default), dark-blue, green #root = Tk() root = customtkinter.CTk() root.title('Tkinter.com - Custom Tkinter Buttons') root.iconbitmap('images/codemy.ico') root.geometry('600x350') def hello(): my_label.configure(text=my_button.cget("text")
๐ŸŒ
Raspberry Pi Forums
forums.raspberrypi.com โ€บ board index โ€บ programming โ€บ python
python3 tkinter make a button look the same - Raspberry Pi Forums
I see MrYsLab beat me to suggesting the sunken trick albeit without disabling the border and doing it in a separate config call> Or you can use themed buttons and have relief set to flat for both pressed and not pressed states. ... import tkinter as tk from tkinter import ttk window = tk.Tk() # Get the style database style = ttk.Style(window) # Create a new TButton style (Flat.TButton) based on a normal TButton but with relief='flat' style.configure('Flat.TButton', relief='flat') # Set the Flat.TButton relief to 'flat' for both pressed and not pressed, you could also use [('', 'flat')] style.map('Flat.TButton', relief=[('pressed', 'flat'), ('!pressed', 'flat')]) # Create button with Flat.TButton style.
๐ŸŒ
HCL GUVI
studytonight.com โ€บ tkinter โ€บ python-tkinter-button-widget
Tkinter Button Widget
Take your tech career to the next level with HCL GUVI's online programming courses. Learn in native languages with job placement support. Enroll now!