I wanted to get input from a tkinter.Text object in python
msg = tkinter.StringVar()
message = tkinter.Entry(mainframe, textvariable=msg)
but it gives an error
I also tried the get method
thetext = message.get('1.0', 'end')
but it gives this error:
return self.tk.call(self._w, 'get', index1, index2)
_tkinter.TclError: invalid command name ".!text"
When you close (destroy) window then it removes (destroys) also
Entry
(and other widgets) and you get error when you try to useEntry
. You have to get text fromEntry
before you close (destroy) window.OR
Because you use
StringVar
inEntry
so you can get this text fromStringVar
even after closing (destroying) window.Minimal working example which shows this problem and solutions.