The dialogs module provides easy-to-use GUI dialogs for simple data input on iOS. It is mostly built on top of the ui module, and while less flexible than using ui directly, it is a lot easier to use and requires very few lines of code in most cases.
Most functions in this module present a dialog and return the user’s input. The following kinds of dialogs are supported:
Present a list of items and return the one(s) that were selected. When the dialog is cancelled, None is returned. The items list can contain any kind of object that can be converted to a string. To get more control over how each item is displayed in the list, you can also use a list of dictionaries (see ui.ListDataSource.items for details).
Present a list of items that can be edited by the user. By default, the user can both rearrange the list and remove items; this behavior can be controlled with the move and delete parameters.
The return value is the modified list of items, or None if the dialog was cancelled.
Present a form dialog, similar to many settings interfaces.
Each field in the dialog is configured by dictionary. If there is only a single section of fields, the list of these field dictionaries can be passed as the fields parameter. If there should be multiple sections, each section is represented by a tuple (usually a 2-tuple containing the title of the section and its list of fields; an optional third item can contain footer text for the section).
The return value of this function is a dictionary of values for each field (or None, if the dialog was cancelled).
A field dictionary should contain the following keys:
'type' is the only required key. If 'key' is not present, the 'title' is used instead. If both are missing, fields are numbered sequentially in the returned dictionary.
Optional keys for all field types:
Optional keys for text/url/email/password/number fields:
Show a multi-line text editor sheet.
The behavior of the editor can be customized with the autocorrection, autocapitalization, and spellchecking parameters. The text parameter controls the initial text in the editor.
The edited text is returned as a string (if the dialog is cancelled, None is returned instead).
Show a date picker dialog, the return value is a datetime.datetime object.
Show a time picker dialog, the return value is a datetime.datetime object.
Show a date/time picker dialog, the return value is a datetime.datetime object.
Show a duration picker dialog (e.g. for a countdown timer), the return value is the selected duration in seconds (e.g. 60.0 for 1 minute).
These functions are imported from the console module for convenience.