How To Change The Button Color When The Button Is Press?
I have a button that has an orange background. But on pressing the button the colour does not remain the same. It changes to its default colour. And on release of button I get back
Solution 1:
Button
widget takes activebackground
and activeforeground
as parameters.
from tkinter import *
root = Tk()
b = Button(root, text='Quit', command="")
b.grid(row=6,column=4,pady=5,padx=10)
b.config(background="darkorange1", foreground="white",
activebackground="darkorange1", activeforeground="white")
root.mainloop()
For a full list of button widget options, you can read it up here.
Post a Comment for "How To Change The Button Color When The Button Is Press?"