[Tutor] newbie TK question
Sun, 23 Jul 2000 18:44:49 +0100
from Tkinter import *
Entry (and a few other widgets) have a textvariable option to which you give
an instance of StringVar. After that your instance (in the case above
myStringVar) has a set and a get method. So I bind a <Return> event to the
entryReturn method and then use .get() to get the contents of the entry.
----- Original Message -----
From: Joseph Stubenrauch <email@example.com>
Sent: Sunday, July 23, 2000 6:06 PM
Subject: [Tutor] newbie TK question
> I am sure that the answer is sitting right under my
> nose, but I've been rummaging through the oneline
> Tkinter documents and can't find a straight answer or
> good example. The solution, I have a feeling, is
> I am trying to create an "Entry" widget that takes its
> contents and puts them in a string whenever the user
> hits the enter key (or perhaps a submit button, but I
> am hoping for enter).
> In other words, if the user types "wakka wakka" into
> the Entry widget at hits enter, it creates a string
> (named answer for example) that equals wakka wakka.
> The Tk tutorial page mentions get() => string but I'm
> not quite sure how to incorporate that and how to make
> it a command that is triggered by a button press or
> the enter key.
> Thanks in advance for the input!
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from anywhere!
> Tutor maillist - Tutor@python.org