.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2018 by Total Control Software License: wxWindows License .. include:: headings.inc .. currentmodule:: wx.lib.floatcanvas.FCObjects .. highlight:: python .. _wx.lib.floatcanvas.FCObjects.ScaledText: ========================================================================================================================================== |phoenix_title| **wx.lib.floatcanvas.FCObjects.ScaledText** ========================================================================================================================================== ##fixme: this can be depricated and jsut use ScaledTextBox with different defaults. This class creates a text object that is scaled when zoomed. It is placed at the coordinates, x,y. the "Position" argument is a two charactor string, indicating where in relation to the coordinates the string should be oriented. The first letter is: t, c, or b, for top, center and bottom The second letter is: l, c, or r, for left, center and right The position refers to the position relative to the text itself. It defaults to "tl" (top left). Size is the size of the font in world coordinates. * Family: Font family, a generic way of referring to fonts without specifying actual facename. One of: * wx.FONTFAMILY_DEFAULT: Chooses a default font. * wx.FONTFAMILY_DECORATIVE: A decorative font. * wx.FONTFAMILY_ROMAN: A formal, serif font. * wx.FONTFAMILY_SCRIPT: A handwriting font. * wx.FONTFAMILY_SWISS: A sans-serif font. * wx.FONTFAMILY_MODERN: A fixed pitch font. .. note:: these are only as good as the wxWindows defaults, which aren't so good. * Style: One of wx.FONTSTYLE_NORMAL, wx.FONTSTYLE_SLANT and wx.FONTSTYLE_ITALIC. * Weight: One of wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_LIGHT and wx.FONTWEIGHT_BOLD. * Underlined: The value can be ``True`` or False. At present this may have an an effect on Windows only. Alternatively, you can set the kw arg: Font, to a wx.Font, and the above will be ignored. The size of the font you specify will be ignored, but the rest of its attributes will be preserved. The size will scale as the drawing is zoomed. Bugs/Limitations: As fonts are scaled, the do end up a little different, so you don't get exactly the same picture as you scale up and doen, but it's pretty darn close. On wxGTK1 on my Linux system, at least, using a font of over about 3000 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 3000 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. The hit-test is done on the entire text extent. This could be made optional, but I haven't gotten around to it. | |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>ScaledText</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.lib.floatcanvas.FCObjects.ScaledText_inheritance.png" alt="Inheritance diagram of ScaledText" 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.lib.floatcanvas.FCObjects.ScaledText.html" title="##fixme: this can be depricated and jsut use ScaledTextBox with different defaults." alt="" coords="191,160,483,189"/> <area shape="rect" id="node2" href="wx.lib.floatcanvas.FCObjects.TextObjectMixin.html" title="A mix in class that holds attributes and methods that are needed by" alt="" coords="5,83,332,112"/> <area shape="rect" id="node3" href="wx.lib.floatcanvas.FCObjects.DrawObject.html" title="This is the base class for all the objects that can be drawn." alt="" coords="357,83,653,112"/> <area shape="rect" id="node4" href="wx.lib.floatcanvas.FCObjects.XYObjectMixin.html" title="This is a mixin class that provides some methods suitable for use" alt="" coords="12,5,325,35"/> </map> </p> </div> | |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.ScaledText.__init__` Initialize self. See help(type(self)) for accurate signature. :meth:`~wx.lib.floatcanvas.FCObjects.ScaledText.CalcBoundingBox` Calculate the bounding box. :meth:`~wx.lib.floatcanvas.FCObjects.ScaledText.LayoutText` A dummy method to re-do the layout of the text. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ScaledText(TextObjectMixin, DrawObject) ##fixme: this can be depricated and jsut use ScaledTextBox with different defaults. This class creates a text object that is scaled when zoomed. It is placed at the coordinates, x,y. the "Position" argument is a two charactor string, indicating where in relation to the coordinates the string should be oriented. The first letter is: t, c, or b, for top, center and bottom The second letter is: l, c, or r, for left, center and right The position refers to the position relative to the text itself. It defaults to "tl" (top left). Size is the size of the font in world coordinates. * Family: Font family, a generic way of referring to fonts without specifying actual facename. One of: * wx.FONTFAMILY_DEFAULT: Chooses a default font. * wx.FONTFAMILY_DECORATIVE: A decorative font. * wx.FONTFAMILY_ROMAN: A formal, serif font. * wx.FONTFAMILY_SCRIPT: A handwriting font. * wx.FONTFAMILY_SWISS: A sans-serif font. * wx.FONTFAMILY_MODERN: A fixed pitch font. .. note:: these are only as good as the wxWindows defaults, which aren't so good. * Style: One of wx.FONTSTYLE_NORMAL, wx.FONTSTYLE_SLANT and wx.FONTSTYLE_ITALIC. * Weight: One of wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_LIGHT and wx.FONTWEIGHT_BOLD. * Underlined: The value can be ``True`` or False. At present this may have an an effect on Windows only. Alternatively, you can set the kw arg: Font, to a wx.Font, and the above will be ignored. The size of the font you specify will be ignored, but the rest of its attributes will be preserved. The size will scale as the drawing is zoomed. Bugs/Limitations: As fonts are scaled, the do end up a little different, so you don't get exactly the same picture as you scale up and doen, but it's pretty darn close. On wxGTK1 on my Linux system, at least, using a font of over about 3000 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 3000 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. The hit-test is done on the entire text extent. This could be made optional, but I haven't gotten around to it. .. method:: __init__(self, String, XY, Size, Color = "Black", BackgroundColor = None, Family = wx.FONTFAMILY_MODERN, Style = wx.FONTSTYLE_NORMAL, Weight = wx.FONTWEIGHT_NORMAL, Underlined = False, Position = 'tl', Font = None, InForeground = False) Initialize self. See help(type(self)) for accurate signature. .. method:: CalcBoundingBox(self) Calculate the bounding box. .. method:: LayoutText(self) A dummy method to re-do the layout of the text. A derived object needs to override this if required.