This dialog allows the user to edit a character and/or paragraph style.
In the constructor, specify the pages that will be created. Use wx.richtext.RichTextFormattingDialog.GetStyle
to retrieve the common style for a given range, and then use wx.richtext.RichTextFormattingDialog.ApplyStyle
to apply the user-selected formatting to a control.
For example:
if self.richTextCtrl.HasSelection():
range = self.richTextCtrl.GetSelectionRange()
else:
range = wx.RichTextRange(0, self.richTextCtrl.GetLastPosition()+1)
pages = wx.richtext.RICHTEXT_FORMAT_FONT \
| wx.richtext.RICHTEXT_FORMAT_INDENTS_SPACING \
| wx.richtext.RICHTEXT_FORMAT_TABS \
| wx.richtext.RICHTEXT_FORMAT_BULLETS
with wx.richtext.RichTextFormattingDialog(pages, self) as dlg:
dlg.GetStyle(self.richTextCtrl, range)
if dlg.ShowModal() == wx.ID_OK:
dlg.ApplyStyle(self.richTextCtrl, range)
Default constructor. |
|
Apply attributes to the given range, only changing attributes that need to be changed. |
|
Creation: see wx.richtext.RichTextFormattingDialog “the constructor” for details about the parameters. |
|
Returns the custom colour data for use by the colour dialog. |
|
Helper for pages to get the top-level dialog. |
|
Helper for pages to get the attributes. |
|
Helper for pages to get the style. |
|
Returns the object to be used to customize the dialog and provide pages. |
|
Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook. |
|
Returns the page identifier of the last page selected (not the control id). |
|
Gets the dialog options, determining what the interface presents to the user. |
|
Returns |
|
Gets common attributes from the given range and calls |
|
Gets the associated style definition, if any. |
|
Gets the associated style sheet, if any. |
|
Returns |
|
Sets the attributes to be edited. |
|
Sets the custom colour data for use by the colour dialog. |
|
Sets the formatting factory object to be used for customization and page creation. |
|
Sets the image list associated with the dialog’s property sheet. |
|
Sets the page identifier of the last page selected (not the control id). |
|
Sets the dialog options, determining what the interface presents to the user. |
|
Pass |
|
Sets the attributes and optionally updates the display, if update is |
|
Sets the style definition and optionally update the display, if update is |
|
Updates the display. |
See |
|
See |
|
See |
|
See |
|
See |
Possible constructors:
RichTextFormattingDialog() -> None
RichTextFormattingDialog(flags : int, parent : Window, title:
str="Formatting", id: int=ID_ANY, pos: Point=DefaultPosition, sz:
Size=DefaultSize, style: int=DEFAULT_DIALOG_STYLE) -> None
This dialog allows the user to edit a character and/or paragraph style.
__init__ (self)
Default constructor.
None
__init__ (self, flags : int, parent : Window, title: str=”Formatting”, id: int=ID_ANY, pos: Point=DefaultPosition, sz: Size=DefaultSize, style: int=DEFAULT_DIALOG_STYLE)
Constructors.
None
Apply attributes to the given range, only changing attributes that need to be changed.
ctrl (wx.richtext.RichTextCtrl)
range (wx.richtext.RichTextRange)
flags (int)
bool
Creation: see wx.richtext.RichTextFormattingDialog “the constructor” for details about the parameters.
TextAttr
variant (WindowVariant)
VisualAttributes
Returns the custom colour data for use by the colour dialog.
ColourData
Helper for pages to get the top-level dialog.
win (wx.Window)
Helper for pages to get the attributes.
win (wx.Window)
TextAttr
Helper for pages to get the style.
win (wx.Window)
Returns the object to be used to customize the dialog and provide pages.
Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.
Returns the page identifier of the last page selected (not the control id).
int
Gets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
int
Returns True
if the dialog will restore the last-selected page.
bool
Gets common attributes from the given range and calls SetAttributes
.
Attributes that do not have common values in the given range will be omitted from the style’s flags.
ctrl (wx.richtext.RichTextCtrl)
range (wx.richtext.RichTextRange)
bool
Gets the associated style definition, if any.
Gets the associated style sheet, if any.
Returns True
if the given option is present.
option (int)
bool
Sets the attributes to be edited.
attr (wx.TextAttr)
None
Sets the custom colour data for use by the colour dialog.
colourData (wx.ColourData)
None
Sets the formatting factory object to be used for customization and page creation.
It deletes the existing factory object.
None
Sets the image list associated with the dialog’s property sheet.
imageList (wx.ImageList)
None
Sets the page identifier of the last page selected (not the control id).
lastPage (int)
None
Sets the dialog options, determining what the interface presents to the user.
Currently the only option is Option_AllowPixelFontSize.
options (int)
None
Pass True
if the dialog should restore the last-selected page.
b (bool)
None
Sets the attributes and optionally updates the display, if update is True
.
style (wx.TextAttr)
update (bool)
bool
Sets the style definition and optionally update the display, if update is True
.
styleDef (wx.richtext.RichTextStyleDefinition)
sheet (wx.richtext.RichTextStyleSheet)
update (bool)
bool
Updates the display.
bool
See GetAttributes
and SetAttributes
See GetImageList
and SetImageList
See GetOptions
and SetOptions
See GetStyleDefinition
and SetStyleDefinition
See GetStyleSheet