I am trying to store the values of a Tkinter text box widget as a string to use in the rest of my code. But every time I have an enter function I am getting errors regarding the defying of the command is not possible in the functionCall.
class text():
master = Tk()
def on_button():
print()
t = Label(master, text="Enter Text ")
e1 = Text(master, width=50, height = 25)
e1.grid(row=0, column =1, rowspan=3, columnspan=4, padx=4, pady=4)
functionCall = Button(master, text='Enter', command=Return)
functionCall.grid(row=4, column=4)
var = StringVar()
def Return(self):
self.TempVar=self.Entry.get()
print(self.TempVar)
I am trying to connect the string inserted with the rest of my code. The concept works with a one-line entry box, but the idea is to have a bigger text box.
text(0function -- is this the only place you're creating a root window? There seems to be a lot of code missing, since you don't show how theon_buttonfunction is being called.Toplevel, not another instance ofTk. That may not be your only problem, but it's definitely a problem.