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: