.. 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.SymbolPickerDialog: ========================================================================================================================================== |phoenix_title| **wx.richtext.SymbolPickerDialog** ========================================================================================================================================== :ref:`wx.richtext.SymbolPickerDialog` presents the user with a choice of fonts and a grid of available characters. This modal dialog provides the application with a selected symbol and optional font selection. Although this dialog is contained in the rich text library, the dialog is generic and can be used in other contexts. To use the dialog, pass a default symbol specified as a string, an initial font name, and a current font name. The difference between the initial font and current font is that the initial font determines what the font control will be set to when the dialog shows - an empty string will show the selection `normal` text. The current font, on the other hand, is used by the dialog to determine what font to display the characters in, even when no initial font is selected. This allows the user (and application) to distinguish between inserting a symbol in the current font, and inserting it with a specified font. When the dialog is dismissed, the application can get the selected symbol with :meth:`wx.richtext.SymbolPickerDialog.GetSymbol` and test whether a font was specified with :meth:`wx.richtext.SymbolPickerDialog.UseNormalFont` ,fetching the specified font with :meth:`wx.richtext.SymbolPickerDialog.GetFontName` . Here's a realistic example, inserting the supplied symbol into a rich text control in either the current font or specified font. :: ctrl = self.FindWindow(ID_RICHTEXT_CTRL) attr = wx.TextAttr() attr.SetFlags(wx.TEXT_ATTR_FONT) ctrl.GetStyle(ctrl.GetInsertionPoint(), attr) currentFontName = '' if (attr.HasFont() and attr.GetFont().IsOk()): currentFontName = attr.GetFont().GetFaceName() # Don't set the initial font in the dialog (so the user is choosing # 'normal text', i.e. the current font) but do tell the dialog # what 'normal text' is. dlg = wx.richtext.SymbolPickerDialog("*", '', currentFontName, self) if dlg.ShowModal() == wx.ID_OK: if dlg.HasSelection(): insertionPoint = ctrl.GetInsertionPoint() ctrl.WriteText(dlg.GetSymbol()) if not dlg.UseNormalFont(): font = attr.GetFont() font.SetFaceName(dlg.GetFontName()) attr.SetFont(font) ctrl.SetStyle(insertionPoint, insertionPoint+1, attr) | |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>SymbolPickerDialog</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.SymbolPickerDialog_inheritance.svg" alt="Inheritance diagram of SymbolPickerDialog" 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.SymbolPickerDialog.html" title="wx.richtext.SymbolPickerDialog presents the user with a choice of fonts and a grid of available characters." alt="" coords="5,466,259,495"/> <area shape="rect" id="node2" href="wx.Dialog.html" title="A dialog box is a window with a title bar and sometimes a system menu, which can be moved around the screen." alt="" coords="82,389,182,418"/> <area shape="rect" id="node3" href="wx.TopLevelWindow.html" title="wx.TopLevelWindow is a common base class for wx.Dialog and wx.Frame." alt="" coords="44,313,220,341"/> <area shape="rect" id="node4" href="wx.NonOwnedWindow.html" title="Common base class for all non-child windows." alt="" coords="36,236,228,265"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window is the base class for all windows and represents any visible object on screen." alt="" coords="77,159,188,188"/> <area shape="rect" id="node6" href="wx.EvtHandler.html" title="A class that can handle events from the windowing system." alt="" coords="66,82,199,111"/> <area shape="rect" id="node7" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="16,5,115,34"/> <area shape="rect" id="node8" href="wx.Trackable.html" title="Add-on base class for a trackable object." alt="" coords="139,5,262,34"/> </map> </p> </div> | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.richtext.SymbolPickerDialog.__init__` Default constructor. :meth:`~wx.richtext.SymbolPickerDialog.Create` Creation: see :ref:`the constructor <wx.richtext.SymbolPickerDialog>` for details about the parameters. :meth:`~wx.richtext.SymbolPickerDialog.GetClassDefaultAttributes` :meth:`~wx.richtext.SymbolPickerDialog.GetFontName` Returns the font name (the font reflected in the font list). :meth:`~wx.richtext.SymbolPickerDialog.GetFromUnicode` Returns ``True`` if the dialog is showing the full range of Unicode characters. :meth:`~wx.richtext.SymbolPickerDialog.GetNormalTextFontName` Gets the font name used for displaying symbols in the absence of a selected font. :meth:`~wx.richtext.SymbolPickerDialog.GetSymbol` Gets the current or initial symbol as a string. :meth:`~wx.richtext.SymbolPickerDialog.GetSymbolChar` Gets the selected symbol character as an integer. :meth:`~wx.richtext.SymbolPickerDialog.HasSelection` Returns ``True`` if a symbol is selected. :meth:`~wx.richtext.SymbolPickerDialog.SetFontName` Sets the initial/selected font name. :meth:`~wx.richtext.SymbolPickerDialog.SetFromUnicode` Sets the internal flag indicating that the full Unicode range should be displayed. :meth:`~wx.richtext.SymbolPickerDialog.SetNormalTextFontName` Sets the name of the font to be used in the absence of a selected font. :meth:`~wx.richtext.SymbolPickerDialog.SetSymbol` Sets the symbol as a one or zero character string. :meth:`~wx.richtext.SymbolPickerDialog.SetUnicodeMode` Sets Unicode display mode. :meth:`~wx.richtext.SymbolPickerDialog.UseNormalFont` Returns ``True`` if the has specified normal text - that is, there is no selected font. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.richtext.SymbolPickerDialog.FontName` See :meth:`~wx.richtext.SymbolPickerDialog.GetFontName` and :meth:`~wx.richtext.SymbolPickerDialog.SetFontName` :attr:`~wx.richtext.SymbolPickerDialog.FromUnicode` See :meth:`~wx.richtext.SymbolPickerDialog.GetFromUnicode` and :meth:`~wx.richtext.SymbolPickerDialog.SetFromUnicode` :attr:`~wx.richtext.SymbolPickerDialog.NormalTextFontName` See :meth:`~wx.richtext.SymbolPickerDialog.GetNormalTextFontName` and :meth:`~wx.richtext.SymbolPickerDialog.SetNormalTextFontName` :attr:`~wx.richtext.SymbolPickerDialog.Symbol` See :meth:`~wx.richtext.SymbolPickerDialog.GetSymbol` and :meth:`~wx.richtext.SymbolPickerDialog.SetSymbol` :attr:`~wx.richtext.SymbolPickerDialog.SymbolChar` See :meth:`~wx.richtext.SymbolPickerDialog.GetSymbolChar` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.richtext.SymbolPickerDialog(Dialog) **Possible constructors**:: SymbolPickerDialog() -> None SymbolPickerDialog(symbol : str, initialFont : str, normalTextFont : str, parent : Window, id: int=ID_ANY, title: str=_("Symbols"), pos: Point=DefaultPosition, size: Size=DefaultSize, style: int=DEFAULT_DIALOG_STYLE|RESIZE_BORDER|CLOSE_BOX) -> None SymbolPickerDialog presents the user with a choice of fonts and a grid of available characters. .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations:** :html:`<hr class="overloadsep" /><br />` **__init__** `(self)` Default constructor. :rtype: `None` :html:`<hr class="overloadsep" /><br />` **__init__** `(self, symbol : str, initialFont : str, normalTextFont : str, parent : Window, id: int=ID_ANY, title: str=_("Symbols"), pos: Point=DefaultPosition, size: Size=DefaultSize, style: int=DEFAULT_DIALOG_STYLE|RESIZE_BORDER|CLOSE_BOX)` Constructor. :param `symbol`: The initial symbol to show. Specify a single character in a string, or an empty string. :type `symbol`: string :param `initialFont`: The initial font to be displayed in the font list. If empty, the item normal text will be selected. :type `initialFont`: string :param `normalTextFont`: The font the dialog will use to display the symbols if the initial font is empty. :type `normalTextFont`: string :param `parent`: The dialog's parent. :type `parent`: wx.Window :param `id`: The dialog's identifier. :type `id`: wx.WindowID :param `title`: The dialog's caption. :type `title`: string :param `pos`: The dialog's position. :type `pos`: wx.Point :param `size`: The dialog's size. :type `size`: wx.Size :param `style`: The dialog's window style. :type `style`: long :rtype: `None` :html:`<hr class="overloadsep" /><br />` .. method:: Create(self, symbol : str, initialFont : str, normalTextFont : str, parent : Window, id: int=ID_ANY, caption: str=GetTranslation("Symbols"), pos: Point=DefaultPosition, size: Size=Size(400,300), style: int=DEFAULT_DIALOG_STYLE|RESIZE_BORDER|CLOSE_BOX) Creation: see :ref:`the constructor <wx.richtext.SymbolPickerDialog>` for details about the parameters. :param `symbol`: :type `symbol`: string :param `initialFont`: :type `initialFont`: string :param `normalTextFont`: :type `normalTextFont`: string :param `parent`: :type `parent`: wx.Window :param `id`: :type `id`: wx.WindowID :param `caption`: :type `caption`: string :param `pos`: :type `pos`: wx.Point :param `size`: :type `size`: wx.Size :param `style`: :type `style`: long :rtype: `bool` .. staticmethod:: GetClassDefaultAttributes(variant: WindowVariant=WINDOW_VARIANT_NORMAL) :param `variant`: :type `variant`: wx.WindowVariant :rtype: `VisualAttributes` .. method:: GetFontName(self) Returns the font name (the font reflected in the font list). :rtype: `str` .. method:: GetFromUnicode(self) Returns ``True`` if the dialog is showing the full range of Unicode characters. :rtype: `bool` .. method:: GetNormalTextFontName(self) Gets the font name used for displaying symbols in the absence of a selected font. :rtype: `str` .. method:: GetSymbol(self) Gets the current or initial symbol as a string. :rtype: `str` .. method:: GetSymbolChar(self) Gets the selected symbol character as an integer. :rtype: `int` .. method:: HasSelection(self) Returns ``True`` if a symbol is selected. :rtype: `bool` .. method:: SetFontName(self, value : str) Sets the initial/selected font name. :param `value`: :type `value`: string :rtype: `None` .. method:: SetFromUnicode(self, value : bool) Sets the internal flag indicating that the full Unicode range should be displayed. :param `value`: :type `value`: bool :rtype: `None` .. method:: SetNormalTextFontName(self, value : str) Sets the name of the font to be used in the absence of a selected font. :param `value`: :type `value`: string :rtype: `None` .. method:: SetSymbol(self, value : str) Sets the symbol as a one or zero character string. :param `value`: :type `value`: string :rtype: `None` .. method:: SetUnicodeMode(self, unicodeMode : bool) Sets Unicode display mode. :param `unicodeMode`: :type `unicodeMode`: bool :rtype: `None` .. method:: UseNormalFont(self) Returns ``True`` if the has specified normal text - that is, there is no selected font. :rtype: `bool` .. attribute:: FontName See :meth:`~wx.richtext.SymbolPickerDialog.GetFontName` and :meth:`~wx.richtext.SymbolPickerDialog.SetFontName` .. attribute:: FromUnicode See :meth:`~wx.richtext.SymbolPickerDialog.GetFromUnicode` and :meth:`~wx.richtext.SymbolPickerDialog.SetFromUnicode` .. attribute:: NormalTextFontName See :meth:`~wx.richtext.SymbolPickerDialog.GetNormalTextFontName` and :meth:`~wx.richtext.SymbolPickerDialog.SetNormalTextFontName` .. attribute:: Symbol See :meth:`~wx.richtext.SymbolPickerDialog.GetSymbol` and :meth:`~wx.richtext.SymbolPickerDialog.SetSymbol` .. attribute:: SymbolChar See :meth:`~wx.richtext.SymbolPickerDialog.GetSymbolChar`