I'm trying to pass a value which is entered by the user at runtime in a textbox using text.get()
The following code is what I'm using:
from tkinter import *
from tkinter import ttk
root = Tk()
#LABEL
label = ttk.Label(root,text = 'FUNCTION CALL')
label.pack()
label.config(justify = CENTER)
label.config(foreground = 'blue')
Label(root, text="ENTER TEXT: ").pack()
#TEXTBOX
text = Text(root,width = 40, height = 1)
text.pack()
text_value = text.get('1.0', '1.end')
#BUTTON
button = ttk.Button(root, text = 'PASS')
button.pack()
#FUNCTION DEF
def call(text_value):
print(text_value)
button.config(command = call(text_value))
root.mainloop()
However the program is fully executed before the text in the textbox is passed into the function and printed
How to get the user input from the textbox and pass it into the function and then execute the function upon clicking the button