A Tkinter window can be customized by adding the properties and attributes such as background color, foreground color, width, height, etc.
The color attribute in config() defines the default color of the main window. We can set the color of the window by defining either Hex Color (e.g., #000 for Black) or the Name of the color. The supported Tkinter color chart can be found here
Example
# Import the required libraries from tkinter import * #Create an instance of Tkinter Frame win = Tk() #Set the geometry win.geometry("700x350") #Set the default color of the window win.config(bg = '#24f3f0') # win.config(bg = 'SkyBlue1') Label(win, text= "Hey There! Welcome to TutorialsPoint", font= ('Helvetica 22 bold'), foreground="navy").pack() win.mainloop()
Output
Running the above code will display a window with the background color that we have set in the code.
The window color can be customized either by defining the HEX or RGB value or the Color name.