Change the color of the Button in tkinter by R4R Team

Add the colour in the Button-



program-



from tkinter import *

win=Tk()

win.title("My first page")
win.geometry("400x400")

button1=Button(win,text="Click1",fg="green",bg="white")
button1.place(x=40,y=40)

button2=Button(win,text="Click2",fg="white",bg="green")
button2.place(x=200,y=200)

win.mainloop()


output-




-In this program, we create a two button and place at the window according to the coordinates
-by 'text' attribute we named the button at user side.

-Here 'fg' used for Forground colour
-'bg' used for Back-ground colour.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!