擅长:python、mysql、java
<p>如果您查看<a href="http://effbot.org/tkinterbook/entry.htm" rel="nofollow noreferrer">http://effbot.org/tkinterbook/entry.htm</a>,您将看到<code>.get()</code>方法返回Tkinter Entry小部件中的当前文本</p>
<p>然而,这通常不是与入口小部件交互的最佳方式。通常,最好的方法是通过textvariable关键字将Tkinter.StringVar分配给小部件,然后您可以<code>.get()</code>和<code>.set()</code>StringVar,并且您写入StringVar的文本将出现在条目的文本区域中。但更重要的是,您可以在StringVar上设置一个“trace”函数,该函数在您更改StringVar的值时执行回调函数,例如使用<code>StringVar.set()</code>方法或有人在Entry小部件中键入一些文本。强大的东西</p>