You Want to know about How to Add or Remove Lable in Tkinter Just Follow bellow this Program.
Example:
from tkinter import *
my_window = Tk()
my_window.title("Update Label text Using Function")
my_window.geometry("800x350+450+86")
my_window.config(bg="#4B0082")
def add_label():
global lbl
lbl = Label(my_window, text="I am New Created Label",font=("Times", 20, "bold"))
lbl.pack()
def remove_label():
global lbl
lbl.pack_forget()
btn1 = Button(my_window, text="Add New Label", font=("Times", 20, "bold"),
command=add_label)
btn2 = Button(my_window, text="Remove Label", font=("Times", 20, "bold"),
command=remove_label)
command=add_label)
btn2 = Button(my_window, text="Remove Label", font=("Times", 20, "bold"),
command=remove_label)
btn1.pack(pady=10)
btn2.pack(pady=10)
my_window.mainloop()
Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.
Enjoy.......
إرسال تعليق