I'm having difficulty figuring out how to change the colour of a button in python using tkinter. All the tutorials I've seen show how to change the colour while the button is pressed. For instance
from tkinter import *
root = Tk()
root.title('Testing')
root.geometry("400x400")
btn = Button(root, text = "Change my colour", bg="#00FF00", activebackground="#FF0000")
btn.pack()
root.mainloop()
is my current code and changes the colour from green to red when pressed, but as soon as you lift the mouse it goes back to green. What I'm looking for is how to keep the button red after it has been clicked, and then change it back when it is clicked again. I appreciate any help or advice, thank you!