Skip to content

Instantly share code, notes, and snippets.

@vigilantPotato
Created April 9, 2024 21:51
Show Gist options
  • Select an option

  • Save vigilantPotato/768f7b572f43d24e9f731c025ca3cd8c to your computer and use it in GitHub Desktop.

Select an option

Save vigilantPotato/768f7b572f43d24e9f731c025ca3cd8c to your computer and use it in GitHub Desktop.
How to reflect the text in entry widget to label by using variable
import ctypes
import tkinter
if __name__ == "__main__":
ctypes.windll.shcore.SetProcessDpiAwareness(1)
root = tkinter.Tk()
#variable
var = tkinter.StringVar(root)
#Label
l = tkinter.Label(root, width=15, bg="lightblue", textvariable=var)
l.pack(pady=3)
#Entry
e1 = tkinter.Entry(root, bd=5, textvariable=var)
e1.pack(padx=3)
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment