简体   繁体   中英

Tkinter Entry widget issue

Why am I getting this error when trying to insert into an Entry box in Tkinter?

File "/usr/lib/python3.10/tkinter/__init__.py", line 3085, in insert

    self.tk.call(self._w, 'insert', index, string)
_tkinter.TclError: invalid command name ".!toplevel.!labelframe.!entry"

This is my code:

_w2.dbEntry.insert(END, "Hello")

I have tried everything, but I cannot understand why. Please advice.

The toplevel or label frame doesn't exist. You haven't shown enough code, but you are either destroying one of those widgets or you never created them prior to inserting text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM