.. 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.ScaledText: ========================================================================================================================================== |phoenix_title| **wx.lib.floatcanvas.FCObjects.ScaledText** ========================================================================================================================================== ##fixme: this can be deprecated and just 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 character 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 done, 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
Inheritance diagram for class ScaledText:
| |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 deprecated and just 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 character 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 done, 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.