phoenix_title wx.RichMessageDialog

Extension of wx.MessageDialog with additional functionality.

This class adds the possibility of using a checkbox (that is especially useful for implementing the “Don’t ask me again” kind of dialogs) and an extra explanatory text which is initially collapsed and not shown to the user but can be expanded to show more information.

Notice that currently the native dialog is used only under MSW when using Vista or later Windows version. Elsewhere, or for older versions of Windows, a generic implementation which is less familiar to the users is used. Because of this it’s recommended to use this class only if you do need its extra functionality and use wx.MessageDialog which does have native implementation under all platforms otherwise. However if you do need to put e.g. a checkbox in a dialog, you should definitely consider using this class instead of using your own custom dialog because it will have much better appearance at least under recent Windows versions.

To use this class, you need to create the dialog object and call ShowCheckBox and/or ShowDetailedText to configure its contents. Other than that, it is used in exactly the same way as wx.MessageDialog and supports all the styles supported by it. In particular, ShowModal return value is the same as for wx.MessageDialog. The only difference is that you need to use IsCheckBoxChecked to examine the checkbox value if you had called ShowCheckBox.

Here is a simple example:

def ShowDialog(self):

    if dont_show:
        return

    dlg = wx.RichMessageDialog(self, "Welcome to my wonderful program!")
    dlg.ShowCheckBox("Don't show welcome dialog again")
    dlg.ShowModal() # return value ignored as we have "Ok" only anyhow

    if dlg.IsCheckBoxChecked():
        # ... make sure we won't show it again the next time ...
        dont_show = True

New in version 2.9.2.

See also

MessageDialog Overview


class_hierarchy Class Hierarchy

Inheritance diagram for class RichMessageDialog:

appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__

Constructor specifying the rich message dialog properties.

GetCheckBoxText

Retrieves the label for the checkbox.

GetClassDefaultAttributes

GetDetailedText

Retrieves the detailed text.

GetFooterIcon

Retrieves the footer icon.

GetFooterText

Retrieves the footer text.

IsCheckBoxChecked

Retrieves the state of the checkbox.

SetFooterIcon

Specify the footer icon set together with the footer text.

SetFooterText

Shows or hides a footer text that is used at the bottom of the dialog together with an optional icon.

ShowCheckBox

Shows a checkbox with a given label or hides it.

ShowDetailedText

Shows or hides a detailed text and an expander that is used to show or hide the detailed text.

ShowModal

Shows the dialog, returning one of wx.ID_OK, wx.ID_CANCEL, wx.ID_YES, wx.ID_NO.


property_summary Properties Summary

CheckBoxText

See GetCheckBoxText

DetailedText

See GetDetailedText

FooterIcon

See GetFooterIcon and SetFooterIcon

FooterText

See GetFooterText and SetFooterText


api Class API

class wx.RichMessageDialog(GenericMessageDialog)

Possible constructors:

RichMessageDialog(parent, message, caption=MessageBoxCaptionStr,
                  style=OK|CENTRE)

Extension of MessageDialog with additional functionality.


Methods

__init__(self, parent, message, caption=MessageBoxCaptionStr, style=OK|CENTRE)

Constructor specifying the rich message dialog properties.

Works just like the constructor for wx.MessageDialog.

Parameters:
  • parent (wx.Window) –

  • message (string) –

  • caption (string) –

  • style (long) –



GetCheckBoxText(self)

Retrieves the label for the checkbox.

Return type:

string

Returns:

The label for the checkbox, will be the empty string if no checkbox is used.



static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)
Parameters:

variant (WindowVariant) –

Return type:

wx.VisualAttributes



GetDetailedText(self)

Retrieves the detailed text.

Return type:

string

Returns:

The detailed text or empty if detailed text is not used.



GetFooterIcon(self)

Retrieves the footer icon.

Return type:

int

Returns:

The footer icon or 0 if footer icon is not used.

New in version 4.1/wxWidgets-3.1.1.

See also

SetFooterIcon



GetFooterText(self)

Retrieves the footer text.

Return type:

string

Returns:

The footer text or empty if footer text is not used.

New in version 4.1/wxWidgets-3.1.1.



IsCheckBoxChecked(self)

Retrieves the state of the checkbox.

If this method is called before showing the dialog, the initial value of the checkbox, as set by ShowCheckBox is used. If it is called after calling wx.Dialog.ShowModal , the value set by the user is returned.

Return type:

bool

Returns:

True if the checkbox is checked or False if not.



SetFooterIcon(self, icon)

Specify the footer icon set together with the footer text.

Valid values are ICON_INFORMATION , ICON_WARNING , ICON_AUTH_NEEDED and ICON_ERROR (notice that ICON_QUESTION is not allowed here).

Parameters:

icon (int) –

New in version 4.1/wxWidgets-3.1.1.



SetFooterText(self, footerText)

Shows or hides a footer text that is used at the bottom of the dialog together with an optional icon.

Parameters:

footerText (string) – The footer text if empty no footer text will be used.

New in version 4.1/wxWidgets-3.1.1.



ShowCheckBox(self, checkBoxText, checked=False)

Shows a checkbox with a given label or hides it.

Parameters:
  • checkBoxText (string) – If the parameter is non-empty a checkbox will be shown with that label, otherwise it will be hidden.

  • checked (bool) – The initial state of the checkbox.



ShowDetailedText(self, detailedText)

Shows or hides a detailed text and an expander that is used to show or hide the detailed text.

Parameters:

detailedText (string) – The detailed text that can be expanded when the dialog is shown, if empty no detailed text will be used.



ShowModal(self)

Shows the dialog, returning one of wx.ID_OK, wx.ID_CANCEL, wx.ID_YES, wx.ID_NO.

IsCheckBoxChecked can be called afterwards to retrieve the value of the check box if one was used.

Return type:

int


Properties

CheckBoxText

See GetCheckBoxText



DetailedText

See GetDetailedText



FooterIcon

See GetFooterIcon and SetFooterIcon



FooterText

See GetFooterText and SetFooterText