Page 296 -
P. 296
guis and data
The Entry and Text widgets let you enter
text data into your GUI
A TEXT FIELD is just a
If you look at the interface design, you’ll see that there are two different types box on the screen that you
of text field you will need to handle: short text and longer, multi-line text can use to enter text.
fields. To deal with these two needs, Python’s tkinter library has two different
widgets for each data-entry type:
Entry widget: for entering single lines of text
The Entry widget is what you’ll use for most of the text fields. You can
create an Entry widget like this:
One single line of text
my_small_field = Entry(app)
Remember that you
always need to import the
tkinter library first.
Text widget: for longer, multi-line text
Because not all text data fits on a single line, tkinter has the Text widget.
Think of email messages, Wikipedia pages, and word processing documents.
For large multi-line data, you need something other than Entry. You need Multiple lines of text
Text:
my_large_field = Text(app)
You can enter large pieces of
textual data in here.
We just checked...
Python is on first.
The Entry and Text fields should be enough to create the Head-Ex we're pretty sure
interface. But it’s not enough to simply create the interface. You also need to
control the data inside it.
you are here 4 261