File: wx.lib.floatcanvas.FCObjects.ScaledText.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (193 lines) | stat: -rw-r--r-- 8,252 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
.. 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>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.floatcanvas.FCObjects.TextObjectMixin.html" title="wx.lib.floatcanvas.FCObjects.TextObjectMixin" alt="" coords="307,83,609,112"/> <area shape="rect" id="node3" href="wx.lib.floatcanvas.FCObjects.ScaledText.html" title="wx.lib.floatcanvas.FCObjects.ScaledText" alt="" coords="165,160,437,189"/> <area shape="rect" id="node2" href="wx.lib.floatcanvas.FCObjects.XYObjectMixin.html" title="wx.lib.floatcanvas.FCObjects.XYObjectMixin" alt="" coords="313,5,604,35"/> <area shape="rect" id="node4" href="wx.lib.floatcanvas.FCObjects.DrawObject.html" title="wx.lib.floatcanvas.FCObjects.DrawObject" alt="" coords="5,83,283,112"/> </map> 
   </p>

|


|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__`                        
:meth:`~wx.lib.floatcanvas.FCObjects.ScaledText.CalcBoundingBox`                 
:meth:`~wx.lib.floatcanvas.FCObjects.ScaledText.LayoutText`                      
================================================================================ ================================================================================


|


|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)


   .. method:: CalcBoundingBox(self)


   .. method:: LayoutText(self)