I am trying to make a program that when I'll write something in the entry and click a button it'll pin up ("hello" + what I've entered in the entry ).It worked when I didn't make it in a variable and also when I made it in a variable and the variable is inside a function, but it didn't work when I made it in a variable but I didn't make it in any function.
from tkinter import *
root = Tk()
root.title("Problems")
root.geometry("1080x720")
root.config(bg="blue")
entry = Entry(root,bg="purple",fg="black")
entry.pack()
Hello = "Hello " + entry.get() + "!"
def click():
myLabel = Label(root, text = Hello)
myLabel.pack()
Button = Button(root,text="enter your name",command=click,bg="Black",fg="white")
Button.pack()
root.mainloop()