Textvariable: We can change the Label information while defining the textvariable    property in the Label widget. Using Label And Entry Widget.


Example:


from tkinter import *

my_window = Tk()
my_window.title("Use of textvarialble")
my_window.geometry("800x350+450+86")
my_window.config(bg="#BFEFFF")

var_1=StringVar()

lbl1 = Label(my_window, font=("helvetica", 20,"bold"), bg="#EEE685",fg="red",
                     borderwidth=20, textvariable=var_1)
lbl1.pack(pady=40)

txt = Entry(my_window, textvariable=var_1, width=30, font=("Times", 20, "bold"))
txt.pack()

var_1.set("I Am New Set Using String Variable")

my_window.mainloop()

Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.


Enjoy..........

Post a Comment

Previous Post Next Post