I have created a song guesser program using Tkinter and I have it so users press a button to play the song, they enter what they think the song is, and after listening and guessing all the songs they press submit. Now on the right side of the entry boxes I have a label which either shows the text "Correct" or "Incorrect" as to whether or not they got the song right, is there a way to make this text green when they have got it correct and red when they have got it wrong. I have experimented with a few things listed in the code below.
from playsound import playsound
import tkinter as tk
from tkinter import *
master=tk.Tk()
master.title("Song Guessing Game")
master.config(bg="ghost white")
def play1():
playsound("sickomode.mp3")
def play2():
playsound("onedance.mp3")
def play3():
playsound("uptownfunk.mp3")
def play4():
playsound("shapeofyou.mp3")
tk.Label(master,text="Song Guesser",font="Verdanda 20 underline bold",bg="ghost white",fg="black").grid(row=0,column=1)
tk.Button(master,text="Play Song 1",command=play1,font="Verdanda 15 bold").grid(row=1,column=0)
tk.Button(master,text="Play Song 2",command=play2,font="Verdanda 15 bold").grid(row=2,column=0)
tk.Button(master,text="Play Song 3",command=play3,font="Verdanda 15 bold").grid(row=3,column=0)
tk.Button(master,text="Play Song 4",command=play4,font="Verdanda 15 bold").grid(row=4,column=0)
guess1=tk.Entry(master,bg="ghost white",fg="black",font="Verdanda 15")
guess2=tk.Entry(master,bg="ghost white",fg="black",font="Verdanda 15")
guess3=tk.Entry(master,bg="ghost white",fg="black",font="Verdanda 15")
guess4=tk.Entry(master,bg="ghost white",fg="black",font="Verdanda 15")
guess1.grid(row=1,column=1)
guess2.grid(row=2,column=1)
guess3.grid(row=3,column=1)
guess4.grid(row=4,column=1)
def submit():
s1guess=str(guess1.get()).upper()
if s1guess=="SICKO MODE":
print ("Correct")
status.set("Correct")
elif s1guess!="SICKO MODE":
print("Incorrect")
status.set("Incorrect")
s2guess=str(guess2.get()).upper()
if s2guess=="ONE DANCE":
print("Correct")
status2.set("Correct")
elif s2guess!="ONE DANCE":
print("Incorrect")
status2.set("Incorrect")
s3guess=str(guess3.get()).upper()
if s3guess=="UPTOWN FUNK":
print("Correct")
status3.set("Correct")
elif s3guess!="UPTOWN FUNK":
print("Incorrect")
status3.set("Incorrect")
s4guess=str(guess4.get()).upper()
if s4guess=="SHAPE OF YOU":
print("Correct")
status4.set("Correct")
elif s4guess!="SHAPE OF YOU":
print("Incorrect")
status4.set("Incorrect")
status=StringVar()
status2=StringVar()
status3=StringVar()
status4=StringVar()
scolor=StringVar()
s2color=StringVar()
s3color=StringVar()
s4color=StringVar()
tk.Label(master,textvariable=status,font="Verdanda 15 bold",fg=scolor.get()).grid(row=1,column=2)
tk.Label(master,textvariable=status2,font="Verdanda 15 bold",fg=s2color.get()).grid(row=2,column=2)
tk.Label(master,textvariable=status3,font="Verdanda 15 bold",fg=s3color.get()).grid(row=3,column=2)
tk.Label(master,textvariable=status4,font="Verdanda 15 bold",fg=s4color.get()).grid(row=4,column=2)
tk.Button(master,text="Submit Score",command=submit).grid(row=5,column=1)
master.mainloop()
The main area I'm looking at is the bottom set of labels. With the current way I have done it I have managed to get it working sort of, but the default value for the scolor variables is just "" which isn't a color and therefore the code doesn't function