Multiple Choice Dialog

Multiple Choice Dialog Sample

Creating the Dialog

Create a Multiple Choice Dialog by calling dialog.multipleChoiceDialog with the four arguments shown in the following table.

Argument
Data type/notes
self
the window (background) that is the parent for the dialog
message
string to be displayed inside the dialog as a prompt for the user
title
string to be displayed in the title bar of the dialog
lst
list of strings containing the choices to be presented to the user

Example:

Above dialog was created with this line of code:

result = dialog.multipleChoiceDialog(self, "message", "title", ['one', 'two', 'three'])

Interacting With the Dialog

The multipleChoiceDialog component returns two 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
selection
list of strings containing the  options chosen by the user.

Example:

The sample dialog shown at the top of this page returns the following results:

accepted: True
selection: ('one', 'three')