get() in Tkinter
Matthew Dixon Cowles
matt at mondoinfo.com
Sat Aug 31 04:03:28 CEST 2002
On Fri, 30 Aug 2002 21:08:05 -0400, Andrew M
<stopviequesbombing at hotmail.com> wrote:
[. . .]
> from Tkinter import *
> # ---interface part cut out---
> def changetext():
> a = str(Entry.get(entrybox1))
> b = a + " ....continue"
> I know this doesn't work, and I think it is the Entry.Insert line.
You're right that it's the insert call that's the problem. You have to
call insert() with an index. And it turns out to be necessary to
delete the previous text first. Something like this:
>>> from Tkinter import *
[I enter some text]
>>> a+=" ...continue"
The best documentation for Tkinter that I know of is Fredrik Lundh's
excellent An Introduction to Tkinter. It's at:
I almost always have a local copy open when I'm doing Tkinter
More information about the Python-list