- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Default window color Tkinter and hex color codes in Tkinter
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.
- Related Articles
- How to use rgb color codes in tkinter?
- JavaScript to generate random hex codes of color
- Changing the background color of a tkinter window using colorchooser module
- Color game using Tkinter in Python
- Setting Background color for Tkinter in Python
- Dynamically change the widget background color in Tkinter
- How to change text cursor color in Tkinter?
- Changing the color a Tkinter rectangle on clicking
- Change the color of "tab header" in ttk.Notebook (tkinter)
- Change the color upon hovering over Button in Tkinter
- How to change the mouse pointer color in Tkinter?
- Generating random hex color in JavaScript
- How to change the color of ttk button in Tkinter?
- How to set the background color of a ttk.Combobox in tkinter?
- How to change the background color of a Treeview in Tkinter?

Advertisements