By default like any other UI you work with, the default color of the text is black, if you want to change it to some other in Tkinter then you need to use the argument - foreground. Let's see an example,
from tkinter import *
window = Tk()
# Changed the color of my black from black to green
my_label_example = Label(window, text='This is my text', foreground='green')
my_label_example.pack()
window.mainloop()
⛏️ You can also use a short-form of this attribute: example: fg='#2848273'
Output:tkinter - Change label text color
⛏️ You can use color names such as - black, white, green, yellow, orange, etc.
⛏️ You can also use hex color code just like you may use with HTML or CSS: Example: #eeeeee, #202020
More Posts related to Python,
- Read JSON File in Python Program
- Convert Float to String in Python
- Python - Convert float to String
- Check if String Contains a Substring - Python
- Install and Run Jupyter Notebook on Mac (macOS)
- Sorting an array using Bubble Sort in Python Programming
- Comments in Python Programming
- 3 Python program to add two numbers
- Read a file line by line in Python Program
- How to uninstall pip Python packages
- Change label (text) color in tkinter
- 7 Python Arithmetic Operators with Examples [Tutorial]
- pip get list of all outdated Python packages
- Where does brew install python in macOS
- How to Convert String to DateTime in Python
- Python: Fix command not found pip or pip3 on zsh shell
- How to add borders to tkinter label text
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- TypeError: must be str, not int
- Python Program To Calculate Simple Interest (SimpleInterest.py)
- Check version of pip package installer for Python
- Change the background of Tkinter label or text
- Set width and height for the label in tkinter
- How to write JSON file in Python Program
- Python raise error with message example
More Posts:
- Java 8: Steam map with Code Examples - Java
- How to extend retiring SharePoint 2010 Workflows and continue with Office 365 - SharePoint
- How to make a div tag clickable - Html
- [Maven] Multiple annotations found at this line pom.xml CoreException, ArtifactResolutionException - Java
- ASCII to HEX and HEX to ASCII Conversion Notepad++ - NotepadPlusPlus
- Facebook Down Will Be Back Soon - Facebook
- How to add ruler in Sublime Text tab window - Sublime-Text
- Detect Data roaming in Android Application - Android