.. include:: headings.inc .. _PySingleChoiceDialog: ========================================================================================================================================== |phoenix_title| **PySingleChoiceDialog** ========================================================================================================================================== This class represents a dialog that shows a list of strings, and allows the user to select one. Double-clicking on a list item is equivalent to single-clicking and then pressing ``OK``. .. _PySingleChoiceDialog-styles: |styles| Window Styles ================================ This class supports the following styles: - ``OK``: Show an ``OK`` button. - ``CANCEL``: Show a Cancel button. - ``CENTRE``: Centre the message. Not Windows. .. seealso:: :ref:`SingleChoiceDialog Overview `, :ref:`MultiChoiceDialog` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **PySingleChoiceDialog** .. raw:: html

Inheritance diagram of PySingleChoiceDialog

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~PySingleChoiceDialog.__init__` Constructor, taking an array of `String` choices and optional client data. :meth:`~PySingleChoiceDialog.GetSelection` Returns the index of selected item. :meth:`~PySingleChoiceDialog.GetStringSelection` Returns the selected string. :meth:`~PySingleChoiceDialog.SetSelection` Sets the index of the initially selected item. :meth:`~PySingleChoiceDialog.ShowModal` Shows the dialog, returning either ``ID_OK`` or ``ID_CANCEL``. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~PySingleChoiceDialog.Selection` See :meth:`~PySingleChoiceDialog.GetSelection` and :meth:`~PySingleChoiceDialog.SetSelection` :attr:`~PySingleChoiceDialog.StringSelection` See :meth:`~PySingleChoiceDialog.GetStringSelection` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: PySingleChoiceDialog(Dialog) This class represents a dialog that shows a list of strings, and allows the user to select one. **Possible constructors**:: PySingleChoiceDialog(parent, message, caption, choices, style=CHOICEDLG_STYLE, pos=DefaultPosition) .. method:: __init__(self, *args, **kw) Constructor, taking an array of `String` choices and optional client data. :param `parent`: Parent window. :type `parent`: Window :param `message`: Message to show on the dialog. :type `message`: string :param `caption`: The dialog caption. :type `caption`: string :param `choices`: An array of strings, or a string list, containing the choices. :type `choices`: list of strings :param `style`: A dialog style (bitlist) containing flags chosen from standard dialog styles and the ones listed in the class documentation. The default value is equivalent to ``DEFAULT_DIALOG_STYLE`` | ``RESIZE_BORDER`` | ``OK`` | ``CANCEL`` | ``CENTRE``. :type `style`: long :param `pos`: Dialog position. Not Windows. :type `pos`: Point An array of client data to be associated with the items. See :meth:`GetSelectionData` . .. note:: Use :meth:`ShowModal` to show the dialog. .. method:: GetSelection(self) Returns the index of selected item. :rtype: `int` .. method:: GetStringSelection(self) Returns the selected string. :rtype: `string` .. method:: SetSelection(self, selection) Sets the index of the initially selected item. :param `selection`: :type `selection`: int .. method:: ShowModal(self) Shows the dialog, returning either ``ID_OK`` or ``ID_CANCEL``. :rtype: `int` .. attribute:: Selection See :meth:`~PySingleChoiceDialog.GetSelection` and :meth:`~PySingleChoiceDialog.SetSelection` .. attribute:: StringSelection See :meth:`~PySingleChoiceDialog.GetStringSelection`