Syntax: lbl = Label(root, options)
root: It Represent Parent Window.
options: used as key value separated by Commas.
Example:
from tkinter import *
root =Tk()
root.title("Delete Label Example")
root.geometry("800x400+450+86")
root.config(bg="#FF7D40")
def update_text():
lbl.configure(text="This is Update Label text")
def on_click():
lbl.after(1000, lbl.destroy()) #Label Will Destroyed after 1000 Milisecond
lbl = Label(root,text="Deleting Label", font=("Times new Roman", 30, "bold italic"),)
lbl.pack(pady=5)
btn1 = Button(root, text="Update",width=15,bg="#7FFFD4",
font=("Times new Roman", 20, "bold italic"),command=update_text)
btn1.pack(pady=10)
btn2 = Button(root, text="Delete",width=15,bg="#7FFFD4",
font=("Times new Roman", 20, "bold italic"),command=on_click)
btn2.pack(pady=10)
root.mainloop()
Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.
إرسال تعليق