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
New in version 2.9.0.
__init__ |
Default constructor. |
AddExtraControls |
Customize the dialog by adding extra controls to it. |
Create |
Effectively creates the dialog for an object created using the default constructor. |
GetList |
Return the list control used by the dialog. |
GetOrder |
Return the array describing the order of items after it was modified by the user. |
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.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
Create
must be called later to effectively create the control.
__init__ (self, parent, message, title=””, order=[], items=[], pos=DefaultPosition, name=RearrangeDialogNameStr)
Constructor creating the dialog.
Please see Create
for the parameters description.
Parameters: |
---|
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 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.
Parameters: | win (wx.Window) – The window containing the extra controls. It must have this dialog as its parent. |
---|
Create
(self, parent, message, title="", order=[], items=[], pos=DefaultPosition, name=RearrangeDialogNameStr)¶Effectively creates the dialog for an object created using the default constructor.
Parameters: |
|
---|---|
Return type: | bool |
Returns: |
|
GetList
(self)¶Return the list control used by the dialog.
Return type: | wx.RearrangeList |
---|
See also
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 wx.RearrangeList for more information about the convention used for this array.
Return type: | list of integers |
---|