tkinter how to change text color code example

Example 1: how to change the font of a label in tkinter

#How to change the font of a label in Tkinter

#Import 
from tkinter import *

#Screen
window = Tk()
window.title("New Window")
window.geometry("300x250")

Label(window, text = "This is my new project in python!", font = ("Bahnschrift", 14)).pack()
#-------------------------------------------------------------------------------------------
#'font' tells python that we are going to do something with the font
#-------------------------------------------------------------------------------------------
#'()' are needed becuase that is just how python works
#-------------------------------------------------------------------------------------------
#'"___"' put your font name in the quotes
#-------------------------------------------------------------------------------------------
#10 put vyour fontsize after adding a comma after the font name
#-------------------------------------------------------------------------------------------

Example 2: tkinter change label text color

label_name.configure(foreground="blue")

Example 3: how to change the color of the cursor in tkinter

tkinter.Text(tk.Tk(), insertbackground="#3C3F41")

Example 4: text color tkinter

from Tkinter import *

def onclick():
   pass

root = Tk()
text = Text(root)
text.insert(INSERT, "Hello.....")
text.insert(END, "Bye Bye.....")
text.pack()

text.tag_add("here", "1.0", "1.4")
text.tag_add("start", "1.8", "1.13")
text.tag_config("here", background="yellow", foreground="blue")
text.tag_config("start", background="black", foreground="green")
root.mainloop()

Example 5: text color python tkinter

from tkinter import *
root=Tk()
l1=Label(root,text="hello world",fg="red").pack()

Example 6: how to change the text of a label in tkinter

def press():
    Instruction.config(text='Button Pressed')