Alfie
Alfie

Reputation: 73

How to change default background colour in tkinter

I want to have all my labels and buttons to have a white background. I know I can use bg="white" in each one but I was thinking if there was a way I could change the default colour to white or make it so that all widgets have a white background with a single line of code. similar to how you can change the font by doing:

from tkinter import *
window=Tk()
window.option_add("*font",("Arial",15))
window.mainloop()

Which will set all the font to Arial 15

Upvotes: 2

Views: 1710

Answers (1)

Alfie
Alfie

Reputation: 73

thanks to @acw1668 's comment, can do window.option_add("*Label*Background", "white") and window.option_add("*Button*Background", "white") to solve it. Just thought id put it as an answer in case people don't see the comment and what not.

Upvotes: 4

Related Questions