You can use the optional arguments bg
and fg
(Note that you might need to use a different option like highlightbackground
on MacOS system as stated In this answer ) - which I believe is a known issue with tk.Button
on MacOS.
import tkinter as tk
root = tk.Tk()
# bg is to change background, fg is to change foreground (technically the text color)
label = tk.Label(root, text="what's my favorite video?",
bg='#fff', fg='#f00', pady=10, padx=10, font=10) # You can use use color names instead of color codes.
label.pack()
click_here = tk.Button(root, text="click here to find out",
bg='#000', fg='#ff0', padx = 10, pady = 5)
click_here.pack()
root.mainloop()
The only reason I added this as an answer is because the last answer I wrote on a similar question for someone on SO, didn't work just because they were using a Mac. If you are on a Windows machine, you are fine.
fg='red'
intk.Label(...)
. – Sensible