Delete the Button in Tkinter Python by R4R Team

Syntax-

buttonobject.destroy()


program-

from tkinter import *
#create a window screen
win=Tk()
win.geometry("400x350")

#function that delete the button
def call():
b.destroy()

#create Button
b=Button(win,text="Delete This",command=call,fg="white",bg="Green",font=('',20,''),bd=10)
b.place(x=50,y=100)

#hold the screen
win.mainloop()


output-




-In this program, we create a Button on the window screen that on clicking call a function 'call()' that destroy the button.

On clicking the Button:-




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!