how to make the button look like mac in tkinter] code example

Example 1: tkinter button background color mac

#Use highlightbackground=color
#For example:

submit = Button(root, text="Generate", highlightbackground='#3E4149')

Example 2: how to make the button look like mac in tkinter]

# To get the buttons look like in macOS you can use tkmacosx 
# example:

from tkinter import *
from tkmacosx import Button

root = Tk()
root.geometry('200x150')
B0 = Button(root, text='Button')
B0.pack(padx=20, pady=(20,0))
B1 = Button(root, text='Button', bg='#ADEFD1', 
            fg='#00203F', borderless=1)
B1.pack(padx=20, pady=10)
B2 = Button(root, text='Button', bg='#E69A8D', 
            fg='#5F4B8B', borderless=1,
            activebackground=('#AE0E36', '#D32E5E'),
            activeforeground='#E69A8D')
B2.pack()
root.mainloop


# To get the latest theme from your OS you can use ttk as show below
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()

Tags:

Misc Example