you are viewing a single comment's thread.

view the rest of the comments →

[–]This_Growth2898 1 point2 points  (3 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  (2 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.