.. 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.richtext.RichTextFormattingDialog:

==========================================================================================================================================
|phoenix_title|  **wx.richtext.RichTextFormattingDialog**
==========================================================================================================================================

This dialog allows the user to edit a character and/or paragraph style.          

In the constructor, specify the pages that will be created. Use :meth:`wx.richtext.RichTextFormattingDialog.GetStyle`   to retrieve the common style for a given range, and then use :meth:`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)











|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>RichTextFormattingDialog</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.richtext.RichTextFormattingDialog_inheritance.png" alt="Inheritance diagram of RichTextFormattingDialog" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.richtext.RichTextFormattingDialog.html" title="wx.richtext.RichTextFormattingDialog" alt="" coords="5,547,272,576"/> <area shape="rect" id="node2" href="wx.adv.PropertySheetDialog.html" title="wx.adv.PropertySheetDialog" alt="" coords="35,469,242,499"/> <area shape="rect" id="node3" href="wx.Dialog.html" title="wx.Dialog" alt="" coords="95,392,182,421"/> <area shape="rect" id="node4" href="wx.TopLevelWindow.html" title="wx.TopLevelWindow" alt="" coords="61,315,216,344"/> <area shape="rect" id="node5" href="wx.NonOwnedWindow.html" title="wx.NonOwnedWindow" alt="" coords="55,237,223,267"/> <area shape="rect" id="node6" href="wx.Window.html" title="wx.Window" alt="" coords="90,160,187,189"/> <area shape="rect" id="node7" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="80,83,197,112"/> <area shape="rect" id="node8" href="wx.Object.html" title="wx.Object" alt="" coords="35,5,122,35"/> <area shape="rect" id="node9" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="147,5,253,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.richtext.RichTextFormattingDialog.__init__`                           Default constructor.
:meth:`~wx.richtext.RichTextFormattingDialog.ApplyStyle`                         Apply attributes to the given range, only changing attributes that need to be changed.
:meth:`~wx.richtext.RichTextFormattingDialog.Create`                             Creation: see :ref:`wx.richtext.RichTextFormattingDialog`  "the constructor" for details about the parameters.
:meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes`                      Gets the attributes being edited.
:meth:`~wx.richtext.RichTextFormattingDialog.GetClassDefaultAttributes`          
:meth:`~wx.richtext.RichTextFormattingDialog.GetColourData`                      Returns the custom colour data for use by the colour dialog.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialog`                          Helper for pages to get the top-level dialog.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialogAttributes`                Helper for pages to get the attributes.
:meth:`~wx.richtext.RichTextFormattingDialog.GetDialogStyleDefinition`           Helper for pages to get the style.
:meth:`~wx.richtext.RichTextFormattingDialog.GetFormattingDialogFactory`         Returns the object to be used to customize the dialog and provide pages.
:meth:`~wx.richtext.RichTextFormattingDialog.GetImageList`                       Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.
:meth:`~wx.richtext.RichTextFormattingDialog.GetLastPage`                        Returns the page identifier of the last page selected (not the control id).
:meth:`~wx.richtext.RichTextFormattingDialog.GetOptions`                         Gets the dialog options, determining what the interface presents to the user.
:meth:`~wx.richtext.RichTextFormattingDialog.GetRestoreLastPage`                 Returns ``True`` if the dialog will restore the last-selected page.
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyle`                           Gets common attributes from the given range and calls :meth:`~RichTextFormattingDialog.SetAttributes` .
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition`                 Gets the associated style definition, if any.
:meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet`                      Gets the associated style sheet, if any.
:meth:`~wx.richtext.RichTextFormattingDialog.HasOption`                          Returns ``True`` if the given option is present.
:meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes`                      Sets the attributes to be edited.
:meth:`~wx.richtext.RichTextFormattingDialog.SetColourData`                      Sets the custom colour data for use by the colour dialog.
:meth:`~wx.richtext.RichTextFormattingDialog.SetFormattingDialogFactory`         Sets the formatting factory object to be used for customization and page creation.
:meth:`~wx.richtext.RichTextFormattingDialog.SetImageList`                       Sets the image list associated with the dialog's property sheet.
:meth:`~wx.richtext.RichTextFormattingDialog.SetLastPage`                        Sets the page identifier of the last page selected (not the control id).
:meth:`~wx.richtext.RichTextFormattingDialog.SetOptions`                         Sets the dialog options, determining what the interface presents to the user.
:meth:`~wx.richtext.RichTextFormattingDialog.SetRestoreLastPage`                 Pass ``True`` if the dialog should restore the last-selected page.
:meth:`~wx.richtext.RichTextFormattingDialog.SetStyle`                           Sets the attributes and optionally updates the display, if `update`  is ``True``.
:meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition`                 Sets the style definition and optionally update the display, if `update`  is ``True``.
:meth:`~wx.richtext.RichTextFormattingDialog.UpdateDisplay`                      Updates the display.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.richtext.RichTextFormattingDialog.Attributes`                         See :meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes` and :meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes`
:attr:`~wx.richtext.RichTextFormattingDialog.ImageList`                          See :meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` and :meth:`~wx.richtext.RichTextFormattingDialog.SetImageList`
:attr:`~wx.richtext.RichTextFormattingDialog.Options`                            See :meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` and :meth:`~wx.richtext.RichTextFormattingDialog.SetOptions`
:attr:`~wx.richtext.RichTextFormattingDialog.StyleDefinition`                    See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` and :meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition`
:attr:`~wx.richtext.RichTextFormattingDialog.StyleSheet`                         See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.richtext.RichTextFormattingDialog(PropertySheetDialog)

   **Possible constructors**::

       RichTextFormattingDialog()
       
       RichTextFormattingDialog(flags, parent, title="Formatting", id=ID_ANY,
                                pos=DefaultPosition, sz=DefaultSize, style=DEFAULT_DIALOG_STYLE)
       
   
   This dialog allows the user to edit a character and/or paragraph
   style.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Default constructor.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, flags, parent, title="Formatting", id=ID_ANY, pos=DefaultPosition, sz=DefaultSize, style=DEFAULT_DIALOG_STYLE)`
      
      Constructors.                  
      
      
      
      
      :param `flags`: The pages to show.   
      :type `flags`: long
      :param `parent`: The dialog's parent.   
      :type `parent`: wx.Window
      :param `title`: The dialog's title.   
      :type `title`: string
      :param `id`: The dialog's ``ID``.   
      :type `id`: wx.WindowID
      :param `pos`: The dialog's position.   
      :type `pos`: wx.Point
      :param `sz`: The dialog's size.   
      :type `sz`: wx.Size
      :param `style`: The dialog's window style.   
      :type `style`: long
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: ApplyStyle(self, ctrl, range, flags=RICHTEXT_SETSTYLE_WITH_UNDO|RICHTEXT_SETSTYLE_OPTIMIZE)

      Apply attributes to the given range, only changing attributes that need to be changed.                  


      :param `ctrl`: 
      :type `ctrl`: wx.richtext.RichTextCtrl
      :param `range`: 
      :type `range`: wx.richtext.RichTextRange
      :param `flags`: 
      :type `flags`: int




      :rtype: `bool`








   .. method:: Create(self, flags, parent, title=GetTranslation("Formatting"), id=ID_ANY, pos=DefaultPosition, sz=DefaultSize, style=DEFAULT_DIALOG_STYLE)

      Creation: see :ref:`wx.richtext.RichTextFormattingDialog`  "the constructor" for details about the parameters.                  


      :param `flags`: 
      :type `flags`: long
      :param `parent`: 
      :type `parent`: wx.Window
      :param `title`: 
      :type `title`: string
      :param `id`: 
      :type `id`: wx.WindowID
      :param `pos`: 
      :type `pos`: wx.Point
      :param `sz`: 
      :type `sz`: wx.Size
      :param `style`: 
      :type `style`: long




      :rtype: `bool`








   .. method:: GetAttributes(self)

      Gets the attributes being edited.                  

      :rtype: :ref:`TextAttr`








   .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)




      :param `variant`: 
      :type `variant`: wx.WindowVariant




      :rtype: :ref:`VisualAttributes`








   .. staticmethod:: GetColourData()

      Returns the custom colour data for use by the colour dialog.                  

      :rtype: :ref:`ColourData`








   .. staticmethod:: GetDialog(win)

      Helper for pages to get the top-level dialog.                  


      :param `win`: 
      :type `win`: wx.Window




      :rtype: :ref:`wx.richtext.RichTextFormattingDialog`








   .. staticmethod:: GetDialogAttributes(win)

      Helper for pages to get the attributes.                  


      :param `win`: 
      :type `win`: wx.Window




      :rtype: :ref:`TextAttr`








   .. staticmethod:: GetDialogStyleDefinition(win)

      Helper for pages to get the style.                  


      :param `win`: 
      :type `win`: wx.Window




      :rtype: :ref:`wx.richtext.RichTextStyleDefinition`








   .. staticmethod:: GetFormattingDialogFactory()

      Returns the object to be used to customize the dialog and provide pages.                  

      :rtype: :ref:`wx.richtext.RichTextFormattingDialogFactory`








   .. method:: GetImageList(self)

      Returns the image list associated with the dialog, used for example if showing the dialog as a toolbook.                  

      :rtype: :ref:`ImageList`








   .. staticmethod:: GetLastPage()

      Returns the page identifier of the last page selected (not the control id).                  

      :rtype: `int`








   .. method:: GetOptions(self)

      Gets the dialog options, determining what the interface presents to the user.                  

      Currently the only option is Option_AllowPixelFontSize.                  

      :rtype: `int`








   .. staticmethod:: GetRestoreLastPage()

      Returns ``True`` if the dialog will restore the last-selected page.                  

      :rtype: `bool`








   .. method:: GetStyle(self, ctrl, range)

      Gets common attributes from the given range and calls :meth:`SetAttributes` .                  

      Attributes that do not have common values in the given range will be omitted from the style's flags.                  


      :param `ctrl`: 
      :type `ctrl`: wx.richtext.RichTextCtrl
      :param `range`: 
      :type `range`: wx.richtext.RichTextRange




      :rtype: `bool`








   .. method:: GetStyleDefinition(self)

      Gets the associated style definition, if any.                  

      :rtype: :ref:`wx.richtext.RichTextStyleDefinition`








   .. method:: GetStyleSheet(self)

      Gets the associated style sheet, if any.                  

      :rtype: :ref:`wx.richtext.RichTextStyleSheet`








   .. method:: HasOption(self, option)

      Returns ``True`` if the given option is present.                  


      :param `option`: 
      :type `option`: int




      :rtype: `bool`








   .. method:: SetAttributes(self, attr)

      Sets the attributes to be edited.                  


      :param `attr`: 
      :type `attr`: wx.TextAttr







   .. staticmethod:: SetColourData(colourData)

      Sets the custom colour data for use by the colour dialog.                  


      :param `colourData`: 
      :type `colourData`: wx.ColourData







   .. staticmethod:: SetFormattingDialogFactory(factory)

      Sets the formatting factory object to be used for customization and page creation.                  

      It deletes the existing factory object.                  


      :param `factory`: 
      :type `factory`: wx.richtext.RichTextFormattingDialogFactory







   .. method:: SetImageList(self, imageList)

      Sets the image list associated with the dialog's property sheet.                  


      :param `imageList`: 
      :type `imageList`: wx.ImageList







   .. staticmethod:: SetLastPage(lastPage)

      Sets the page identifier of the last page selected (not the control id).                  


      :param `lastPage`: 
      :type `lastPage`: int







   .. method:: SetOptions(self, options)

      Sets the dialog options, determining what the interface presents to the user.                  

      Currently the only option is Option_AllowPixelFontSize.                  


      :param `options`: 
      :type `options`: int







   .. staticmethod:: SetRestoreLastPage(b)

      Pass ``True`` if the dialog should restore the last-selected page.                  


      :param `b`: 
      :type `b`: bool







   .. method:: SetStyle(self, style, update=True)

      Sets the attributes and optionally updates the display, if `update`  is ``True``.                  


      :param `style`: 
      :type `style`: wx.TextAttr
      :param `update`: 
      :type `update`: bool




      :rtype: `bool`








   .. method:: SetStyleDefinition(self, styleDef, sheet, update=True)

      Sets the style definition and optionally update the display, if `update`  is ``True``.                  


      :param `styleDef`: 
      :type `styleDef`: wx.richtext.RichTextStyleDefinition
      :param `sheet`: 
      :type `sheet`: wx.richtext.RichTextStyleSheet
      :param `update`: 
      :type `update`: bool




      :rtype: `bool`








   .. method:: UpdateDisplay(self)

      Updates the display.                  

      :rtype: `bool`








   .. attribute:: Attributes

      See :meth:`~wx.richtext.RichTextFormattingDialog.GetAttributes` and :meth:`~wx.richtext.RichTextFormattingDialog.SetAttributes`


   .. attribute:: ImageList

      See :meth:`~wx.richtext.RichTextFormattingDialog.GetImageList` and :meth:`~wx.richtext.RichTextFormattingDialog.SetImageList`


   .. attribute:: Options

      See :meth:`~wx.richtext.RichTextFormattingDialog.GetOptions` and :meth:`~wx.richtext.RichTextFormattingDialog.SetOptions`


   .. attribute:: StyleDefinition

      See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleDefinition` and :meth:`~wx.richtext.RichTextFormattingDialog.SetStyleDefinition`


   .. attribute:: StyleSheet

      See :meth:`~wx.richtext.RichTextFormattingDialog.GetStyleSheet`

