# Text Entry Dialog

## Creating the Dialog

Create a Text Entry Dialog by calling dialog.textEntryDialog with the four required and one optional arguments shown in the following table.

Argument | Data type/notes
self | the window (background) that is the parent for the dialog
message | quoted string to be displayed inside the Text Entry Dialog to prompt the user's reply
title | quoted string to be displayed in the title bar of the Text Entry Dialog
defaultText | quoted string to be displayed in the text field in the Text Entry Dialog containing the response to be used if the user doesn't change it. May be an empty string.
OPTIONAL field type | The optional fifth argument to the constructor for this dialog can contain one of two constants that affect the display of the text field. If this argument is wx.TE_PASSWORD, asterisks or bullets replace the default text (if any) as well as the user's typing in the field. If this argument is wx.TE_MULTILINE, the field expands to accommodate multiple lines of entry data.

Example:
Above dialog was created with this line of code:
`result = dialog.textEntryDialog(self,
'What is your favorite language?',
'A window title',
'Python')`

## Interacting With the Dialog

The textEntryDialog component returns three values, stored as elements of the Python dictionary called "results" returned by all PythonCard dialogs. These results are as shown in the following table.

Name of value | Description
accepted | True = user clicked OK False = user clicked Cancel
returnedString | String containing the label of the button the user clicked
text | String containing the text in the text entry field of the dialog at the time the user clicked the button or closed the dialog

Example:
The sample dialog shown at the top of this page returns the following results if the user doesn't change anything and clicks the "OK" button:
accepted: True
returnedString: Ok
text: Python