.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.RearrangeDialog: ========================================================================================================================================== |phoenix_title| **wx.RearrangeDialog** ========================================================================================================================================== A dialog allowing the user to rearrange the specified items. This dialog can be used to allow the user to modify the order of the items and to enable or disable them individually. For example: :: items = ["meat", "fish", "fruits", "beer"] order = [3, 0, 1, 2] dlg = wx.RearrangeDialog(None, "You can also uncheck the items you don't like " "at all.", "Sort the items in order of preference", order, items) if dlg.ShowModal() == wx.ID_OK: order = dlg.GetOrder() for n in order: if n >= 0: wx.LogMessage("Your most preferred item is \"%s\""%n) break .. versionadded:: 2.9.0 | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class RearrangeDialog:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.rearrangedialog.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/wx.rearrangedialog.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.RearrangeDialog.__init__` Default constructor. :meth:`~wx.RearrangeDialog.AddExtraControls` Customize the dialog by adding extra controls to it. :meth:`~wx.RearrangeDialog.Create` Effectively creates the dialog for an object created using the default constructor. :meth:`~wx.RearrangeDialog.GetClassDefaultAttributes` :meth:`~wx.RearrangeDialog.GetList` Return the list control used by the dialog. :meth:`~wx.RearrangeDialog.GetOrder` Return the array describing the order of items after it was modified by the user. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.RearrangeDialog.List` See :meth:`~wx.RearrangeDialog.GetList` :attr:`~wx.RearrangeDialog.Order` See :meth:`~wx.RearrangeDialog.GetOrder` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.RearrangeDialog(Dialog) **Possible constructors**:: RearrangeDialog() RearrangeDialog(parent, message, title="", order=[], items=[], pos=DefaultPosition, name=RearrangeDialogNameStr) A dialog allowing the user to rearrange the specified items. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self)` Default constructor. :meth:`Create` must be called later to effectively create the control. :html:`

` **__init__** `(self, parent, message, title="", order=[], items=[], pos=DefaultPosition, name=RearrangeDialogNameStr)` Constructor creating the dialog. Please see :meth:`Create` for the parameters description. :param `parent`: :type `parent`: wx.Window :param `message`: :type `message`: string :param `title`: :type `title`: string :param `order`: :type `order`: list of integers :param `items`: :type `items`: list of strings :param `pos`: :type `pos`: wx.Point :param `name`: :type `name`: string :html:`

` .. method:: AddExtraControls(self, win) Customize the dialog by adding extra controls to it. This function adds the given `win` to the dialog, putting it just below the part occupied by :ref:`wx.RearrangeCtrl`. It must be called after creating the dialog and you will typically need to process the events generated by the extra controls for them to do something useful. For example: :: class MyRearrangeDialog(wx.RearrangeDialog): def __init__(self, parent): wx.RearrangeDialog.__init__(self, parent) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(wx.StaticText(panel, wx.ID_ANY, "Column width in pixels:")) sizer.Add(wx.TextCtrl(panel, wx.ID_ANY, "")) panel.SetSizer(sizer) self.AddExtraControls(panel) # ... code to update the text control with the currently selected # item width and to react to its changes omitted ... See also the complete example of a custom rearrange dialog in the dialogs sample. :param `win`: The window containing the extra controls. It must have this dialog as its parent. :type `win`: wx.Window .. method:: Create(self, parent, message, title="", order=[], items=[], pos=DefaultPosition, name=RearrangeDialogNameStr) Effectively creates the dialog for an object created using the default constructor. :param `parent`: The dialog parent, possibly ``None``. :type `parent`: wx.Window :param `message`: The message shown inside the dialog itself, above the items list. :type `message`: string :param `title`: The title of the dialog. :type `title`: string :param `order`: The initial order of the items in the convention used by :ref:`wx.RearrangeList`. :type `order`: list of integers :param `items`: The items to show in the dialog. :type `items`: list of strings :param `pos`: Optional dialog position. :type `pos`: wx.Point :param `name`: Optional dialog name. :type `name`: string :rtype: `bool` :returns: ``True`` if the dialog was successfully created or ``False`` if creation failed. .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) :param `variant`: :type `variant`: wx.WindowVariant :rtype: :ref:`wx.VisualAttributes` .. method:: GetList(self) Return the list control used by the dialog. :rtype: :ref:`wx.RearrangeList` .. seealso:: :meth:`wx.RearrangeCtrl.GetList` .. method:: GetOrder(self) Return the array describing the order of items after it was modified by the user. Please notice that the array will contain negative items if any items were unchecked. See :ref:`wx.RearrangeList` for more information about the convention used for this array. :rtype: `list of integers` .. attribute:: List See :meth:`~wx.RearrangeDialog.GetList` .. attribute:: Order See :meth:`~wx.RearrangeDialog.GetOrder`