.. 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 .. currentmodule:: wx.lib.floatcanvas.FCObjects .. highlight:: python .. _wx.lib.floatcanvas.FCObjects.ScaledTextBox: ========================================================================================================================================== |phoenix_title| **wx.lib.floatcanvas.FCObjects.ScaledTextBox** ========================================================================================================================================== Draws a text object The object is scaled when zoomed. The hit-test is done on the entire text extent Bugs/Limitations: As fonts are scaled, they do end up a little different, so you don't get exactly the same picture as you scale up and down, but it's pretty darn close. On wxGTK1 on my Linux system, at least, using a font of over about 1000 pts. brings the system to a halt. It's the Font Server using huge amounts of memory. My work around is to max the font size to 1000 points, so it won't scale past there. GTK2 uses smarter font drawing, so that may not be an issue in future versions, so feel free to test. Another smarter way to do it would be to set a global zoom limit at that point. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class ScaledTextBox:
| |super_classes| Known Superclasses ================================== :class:`wx.lib.floatcanvas.FCObjects.DrawObject`, :class:`wx.lib.floatcanvas.FCObjects.TextObjectMixin` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.floatcanvas.FCObjects.ScaledTextBox.__init__` Default class constructor. :meth:`~wx.lib.floatcanvas.FCObjects.ScaledTextBox.CalcBoundingBox` Calculates the Bounding Box :meth:`~wx.lib.floatcanvas.FCObjects.ScaledTextBox.GetBoxRect` :meth:`~wx.lib.floatcanvas.FCObjects.ScaledTextBox.LayoutText` Calculates the positions of the words of text. :meth:`~wx.lib.floatcanvas.FCObjects.ScaledTextBox.ReWrap` :meth:`~wx.lib.floatcanvas.FCObjects.ScaledTextBox.WrapToWidth` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ScaledTextBox(TextObjectMixin, DrawObject) Draws a text object The object is scaled when zoomed. The hit-test is done on the entire text extent Bugs/Limitations: As fonts are scaled, they do end up a little different, so you don't get exactly the same picture as you scale up and down, but it's pretty darn close. On wxGTK1 on my Linux system, at least, using a font of over about 1000 pts. brings the system to a halt. It's the Font Server using huge amounts of memory. My work around is to max the font size to 1000 points, so it won't scale past there. GTK2 uses smarter font drawing, so that may not be an issue in future versions, so feel free to test. Another smarter way to do it would be to set a global zoom limit at that point. .. method:: __init__(self, String, Point, Size, Color = "Black", BackgroundColor = None, LineColor = 'Black', LineStyle = 'Solid', LineWidth = 1, Width = None, PadSize = None, Family = wx.FONTFAMILY_MODERN, Style = wx.FONTSTYLE_NORMAL, Weight = wx.FONTWEIGHT_NORMAL, Underlined = False, Position = 'tl', Alignment = "left", Font = None, LineSpacing = 1.0, InForeground = False) Default class constructor. :param `Point`: takes a 2-tuple, or a (2,) `NumPy `_ array of point coordinates :param integer `Size`: size in World units :param `Color`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor` :param `BackgroundColor`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor` :param `LineColor`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetColor` :param `LineWidth`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetLineWidth` :param `Width`: width in pixels or ``None``, text will be wrapped to the given width. :param `PadSize`: padding in world units or ``None``, if specified it will creating a space (margin) around the text :param wx.FontFamily `Family`: a valid :ref:`wx.FontFamily` :param wx.FontStyle `Style`: a valid :ref:`wx.FontStyle` :param wx.FontWeight `Weight`: a valid :ref:`wx.FontWeight` :param boolean `Underlined`: underline the text :param string `Position`: a two character string indicating where in relation to the coordinates the box should be oriented ============== ========================== 1st character Meaning ============== ========================== ``t`` top ``c`` center ``b`` bottom ============== ========================== ============== ========================== 2nd character Meaning ============== ========================== ``l`` left ``c`` center ``r`` right ============== ========================== :param `Alignment`: see :meth:`~lib.floatcanvas.FloatCanvas.DrawObject.SetLineWidth` :param wx.Font `Font`: alternatively a valid :class:`wx.Font` can be defined in which case the above will be ignored :param float `LineSpacing`: the line space to be used :param boolean `InForeground`: should object be in foreground .. method:: CalcBoundingBox(self) Calculates the Bounding Box .. method:: GetBoxRect(self) .. method:: LayoutText(self) Calculates the positions of the words of text. This isn't exact, as fonts don't scale exactly. To help this, the position of each individual word is stored separately, so that the general layout stays the same in world coordinates, as the fonts scale. .. method:: ReWrap(self, Width) .. method:: WrapToWidth(self)