How to make python tkinter match button to OS How to make python tkinter match button to OS tkinter tkinter

How to make python tkinter match button to OS


You can use tkinter.ttk which provides a modern OS style theme to your TK widgets. Example from the docs:

from tkinter import ttkimport tkinterroot = tkinter.Tk()ttk.Style().configure("TButton", padding=6, relief="flat",   background="#ccc")btn = ttk.Button(text="Sample")btn.pack()root.mainloop()#Output:

enter image description here


Use tkinter.ttk to get themed version

from tkinter.ttk import *from tkinter import messageboxwindow = Tk()window.title("Welcome to LikeGeeks app")window.geometry('350x200')def clicked():    messagebox.showinfo('Message title', 'Message content')btn = Button(window,text='Click here', command=clicked)btn.grid(column=0,row=0)window.mainloop()

Before After

doc