Create clickable Button by tkinter in python by R4R Team


program-



from tkinter import *

win=Tk()

win.title("My first page")

def colorchange():
button1.config(bg="green")
button1.config(fg="White")

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

win.mainloop()


output-




-In this program , we make a function named as "colorchange()" that are able to change the colour of the button by click on the button.

-Here we create a button, named as "Click", on clicking at this button, the output will become like this-





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!