Every time I run this, type something, and then click the button, it says "name 'entry' is not defined". Why? I thought 'entry' was defined.
def displayText():
textToDisplay=entry.get()
label.config(text=textToDisplay)
def main():
import tkinter as tk
window=tk.Tk()
label=tk.Label(master=window, text="When you press the button below, whatever is in the text box will be displayed here")
label.pack()
entry=tk.Entry(width=10, bg="white", fg="black")
entry.pack()
button=tk.Button(text="Click", width=10, command=displayText)
button.pack()
entry.insert(0, "")
window.mainloop()
sys.exit(0)
if(__name__=="__main__"):
main()