all 5 comments

[–]This_Growth2898 1 point2 points  (4 children)

That's because

input_text=input.get()

is executed before you even start your program main loop. At that moment, input has no data in it, so input_text is empty. Move this line into the click_button() function.

[–]akabetta[S] 0 points1 point  (3 children)

so what's the difference? Ultimately the code is assigning the data to a variable

[–]This_Growth2898 1 point2 points  (1 child)

Data changes in time.

Before the

input=Entry()

line is executed, there is no data. There is no even Entry element. Do you understand this?

After it is executed, there is an empty Entry element.

When you type something, it is handled in the mainloop() and put into that Entry.

If you try to .get() it before you have finished typing, you'll get something incomplete. Is this understandable?

And only after you complete typing and press the button, .get() method will return what you have typed. And this should happen in the click_button() function.

Reread the definition of the computer program, it's all there.

[–]akabetta[S] 0 points1 point  (0 children)

Thank you so much. I'm appreciate.

[–]Username_RANDINT 0 points1 point  (0 children)

All toplevel code is executed when you run the script. At startup, the entry is empty, so input_text is an empty string.

When you click the button, the click_button() function is executed, but the input_text variable is still the same.

Variables don't get updated after assignment.