/usr/share/pyshared/visual/text.py is in python-visual 1:5.12-1.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | from visual import *
__all__ = visual._fix_symbols( globals() ) + [
'text' ]
# Display extruded text (uppercase only at present)
# By default, display text along x axis, with letters pointing up parallel to y axis
# Bruce Sherwood, Carnegie Mellon University, begun March 2000, revised June 2006
# Example with default values:
# text(pos=(0,0,0), axis=(1,0,0), string='ABC',
# height=1, depth=0, width=1,
# color=currentdisplay.foreground, up=(0,1,0.3))
# Axis is direction along which text advances.
# If width not specified, it is the same as height.
# Depth is measured forward from pos.
# Only numbers and uppercase letters at present: others display as '*'
# If justify is "center" pos is the center of the text.
# If justify is "right" pos is the right end of the text.
# The reshape method lets you change the pos, width, height, and color
# of an existing text.
# You can set the visible attribute of the text.
defaultdir = vector(1.0,0.,0.)
defaultup = vector(0.,1.0,0.)
letters = {' ': [(0.39,0,0)],
'A': [[(0,0,0), (0.13,0,0), (0.37,1.0,0)],
[(0.88,0,0), (-0.13,0,0),(-0.37,1.0,0)],
[(0.2,0.3,0), (0.5,0,0), (0,0.1,0)],
(1.0,0,0)],
'B': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.1,1.0,0), (0.4,0,0), (0,-0.12,0)],
[(0.1,0.47,0), (0.4,0,0), (0,0.12,0)],
[(0.1,0,0), (0.4,0,0), (0,0.12,0)],
[(0.5,1.0,0), (0.26,-0.1,0), (0,-0.12,0)],
[(0.76,0.9,0), (-0.13,0,0), (0,-0.3,0)],
[(0.5,0.47,0), (0.26,0.1,0), (0,0.12,0)],
[(0.5,0.59,0), (0.26,-0.1,0), (0,-0.12,0)],
[(0.76,0.42,0), (-0.13,0,0), (0,-0.3,0)],
[(0.5,0,0), (0.26,0.1,0), (0,0.12,0)],
(0.88,0,0)],
'C': [[(0,0.2,0), (0.13,0,0), (0,0.6,0)],
[(0.26,1.0,0), (0.36,0,0), (0,-0.13,0)],
[(0.26,0,0), (0.36,0,0), (0,0.13,0)],
[(0.62,1.0,0), (0.26,-0.2,0), (0,-0.13,0)],
[(0,0.8,0), (0.26,0.2,0), (0,-0.13,0)],
[(0,0.2,0), (0.26,-0.2,0), (0,0.13,0)],
[(0.62,0,0), (0.26,0.2,0), (0,0.13,0)],
(1.05,0,0)],
'D': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.1,1.0,0), (0.4,0,0), (0,-0.12,0)],
[(0.1,0,0), (0.4,0,0), (0,0.12,0)],
[(0.5,1.0,0), (0.26,-0.1,0), (0,-0.12,0)],
[(0.76,0.9,0), (-0.13,0,0), (0,-0.8,0)],
[(0.5,0,0), (0.26,0.1,0), (0,0.12,0)],
(1.01,0,0)],
'E': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.1,1.0,0), (0.63,0,0), (0,-0.12,0)],
[(0.1,0.46,0), (0.58,0,0), (0,0.11,0)],
[(0.1,0,0), (0.63,0,0), (0,0.12,0)],
(0.93,0,0)],
'F': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.1,1.0,0), (0.58,0,0), (0,-0.12,0)],
[(0.1,0.46,0), (0.52,0,0), (0,0.11,0)],
(0.8,0,0)],
'G': [[(0,0.2,0), (0.13,0,0), (0,0.6,0)],
[(0.26,1.0,0), (0.36,0,0), (0,-0.13,0)],
[(0.26,0,0), (0.36,0,0), (0,0.13,0)],
[(0.62,1.0,0), (0.26,-0.2,0), (0,-0.13,0)],
[(0,0.8,0), (0.26,0.2,0), (0,-0.13,0)],
[(0,0.2,0), (0.26,-0.2,0), (0,0.13,0)],
[(0.62,0,0), (0.26,0.2,0), (0,0.13,0)],
[(0.47,0.35,0), (0.44,0,0), (0,0.12,0)],
[(0.92,0.47,0), (-0.1,0,0), (0,-0.47,0)],
(1.05,0,0)],
'H': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.1,0.47,0), (0.6,0,0), (0,0.12,0)],
[(0.69,0,0), (0.13,0,0), (0,1.0,0)],
(1.02,0,0)],
'I': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
(0.28,0,0)],
'J': [[(0.43,1.0,0), (0.13,0,0), (0,-0.78,0)],
[(0,0.35,0), (0,-0.13,0), (0.12,0,0)],
[(0.2,0,0), (-0.2,0.22,0), (0,0.13,0)],
[(0.2,0,0), (0.1,0,0), (0,0.13,0)],
[(0.3,0,0), (0.26,0.22,0), (0,0.13,0)],
(0.78,0,0)],
'K': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.13,0.36,0), (0.47,0.44,0), (0,0.16,0)],
[(0.6,0.8,0), (0.2,0.2,0), (-0.18,0,0)],
[(0.8,0,0), (-0.18,0,0), (-0.4,0.6,0)],
(0.92,0,0)],
'L': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0,0,0), (0.64,0,0), (0,0.13,0)],
(0.78,0,0)],
'M': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.07,1.0,0), (0.13,0,0), (0.34,-1.0,0)],
[(0.85,1.0,0), (-0.13,0,0), (-0.31,-1.0,0)],
[(0.82,0,0), (0.13,0,0), (0,1.0,0)],
(1.16,0,0)],
'N': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.01,1.0,0), (0.15,0,0), (0.63,-1.0,0)],
[(0.66,0,0), (0.13,0,0), (0,1.0,0)],
(1.0,0,0)],
'O': [[(0,0.2,0), (0.13,0,0), (0,0.6,0)],
[(0.26,1.0,0), (0.46,0,0), (0,-0.13,0)],
[(0.26,0,0), (0.46,0,0), (0,0.13,0)],
[(0.72,1.0,0), (0.26,-0.2,0), (0,-0.13,0)],
[(0,0.8,0), (0.26,0.2,0), (0,-0.13,0)],
[(0,0.2,0), (0.26,-0.2,0), (0,0.13,0)],
[(0.72,0,0), (0.26,0.2,0), (0,0.13,0)],
[(0.85,0.2,0), (0,0.6,0), (0.13,0,0)],
(1.13,0,0)],
'P': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.1,1.0,0), (0.4,0,0), (0,-0.12,0)],
[(0.1,0.47,0), (0.4,0,0), (0,0.12,0)],
[(0.5,1.0,0), (0.26,-0.1,0), (0,-0.12,0)],
[(0.76,0.9,0), (-0.13,0,0), (0,-0.3,0)],
[(0.5,0.47,0), (0.26,0.1,0), (0,0.12,0)],
(0.85,0,0)],
'Q': [[(0,0.2,0), (0.13,0,0), (0,0.6,0)],
[(0.26,1.0,0), (0.46,0,0), (0,-0.13,0)],
[(0.26,0,0), (0.46,0,0), (0,0.13,0)],
[(0.72,1.0,0), (0.26,-0.2,0), (0,-0.13,0)],
[(0,0.8,0), (0.26,0.2,0), (0,-0.13,0)],
[(0,0.2,0), (0.26,-0.2,0), (0,0.13,0)],
[(0.72,0,0), (0.26,0.2,0), (0,0.13,0)],
[(0.85,0.2,0), (0,0.6,0), (0.13,0,0)],
[(0.53,0.21,0), (0.07,0.08,0), (0.36,-0.28,0)],
(1.14,0,0)],
'R': [[(0,0,0), (0.13,0,0), (0,1.0,0)],
[(0.1,1.0,0), (0.4,0,0), (0,-0.12,0)],
[(0.1,0.47,0), (0.4,0,0), (0,0.12,0)],
[(0.5,1.0,0), (0.26,-0.1,0), (0,-0.12,0)],
[(0.76,0.9,0), (-0.13,0,0), (0,-0.3,0)],
[(0.5,0.47,0), (0.26,0.1,0), (0,0.12,0)],
[(0.5,0.59,0), (0.26,-0.1,0), (0,-0.12,0)],
[(0.76,0.42,0), (-0.13,0,0), (0,-0.3,0)],
[(0.76,0.12,0), (-0.13,0,0), (0.05,-.12,0)],
(0.95,0,0)],
'S': [[(0,0.33,0), (0.12,0,0), (0,-0.13,0)],
[(0,0.2,0), (0.12,0,0), (0.2,-0.2,0)],
[(0.2,0,0), (0,0.12,0), (0.38,0,0)],
[(0.58,0,0), (-0.12,0,0), (0.2,0.2,0)],
[(0.78,0.2,0), (-0.12,0,0), (0,0.3,0)],
[(0.78,0.4,0), (0,0.13,0), (-0.73,0.24,0)],
[(0.05,0.64,0), (0,0.16,0), (0.13,0,0)],
[(0.05,0.80,0), (0.13,0,0), (0.2,0.2,0)],
[(0.25,1.0,0), (0.3,0,0), (0,-0.13,0)],
[(0.55,1.0,0), (-0.13,0,0), (0.2,-0.2,0)],
(0.93,0,0)],
'T': [[(0.34,0,0), (0.13,0,0), (0,1.0,0)],
[(0,1.0,0), (0.8,0,0), (0,-0.12,0)],
(0.93,0,0)],
'U': [[(0,1.0,0), (0.13,0,0), (0,-0.78,0)],
[(0.65,1.0,0), (0.13,0,0), (0,-0.78,0)],
[(0,0.22,0), (0.26,-0.22,0), (0,0.13,0)],
[(0.26,0,0), (0.26,0,0), (0,0.13,0)],
[(0.52,0,0), (0.26,0.22,0), (0,0.13,0)],
(0.92,0,0)],
'V': [[(0,1.0,0), (0.15,0,0), (0.36,-1.0,0)],
[(0.86,1.0,0), (-0.15,0,0), (-0.36,-1.0,0)],
(0.92,0,0)],
'W': [[(0,1.0,0), (0.15,0,0), (0.25,-1.0,0)],
[(0.71,1.0,0), (-0.15,0,0), (-0.25,-1.0,0)],
[(0.6,1.0,0), (0.15,0,0), (0.25,-1.0,0)],
[(1.26,1.0,0), (-0.15,0,0), (-0.25,-1.0,0)],
(1.3,0,0)],
'X': [[(0.02,1.0,0), (0.17,0,0), (0.68,-1.0,0)],
[(0,0,0), (0.17,0,0), (0.69,1.0,0)],
(0.92,0,0)],
'Y': [[(0.38,0,0), (0.13,0,0), (0,0.4,0)],
[(0.15,1.0,0), (0,-0.24,0), (0.30,-0.48,0)],
[(0,1.0,0), (0.15,0,0), (0.15,-0.24,0)],
[(0.73,1.0,0), (0,-0.24,0), (-0.28,-0.48,0)],
[(0.88,1.0,0), (-0.15,0,0), (-0.15,-0.24,0)],
(0.93,0,0)],
'Z': [[(0,0,0), (0.78,0,0), (0,0.12,0)],
[(0.05,1.0,0), (0.73,0,0), (0,-0.12,0)],
[(0,0.12,0), (0.17,0,0), (0.61,0.76,0)],
(0.83,0,0)],
'0': [[(0,0.2,0), (0.13,0,0), (0,0.6,0)],
[(0.26,1.0,0), (0.14,0,0), (0,-0.13,0)],
[(0.26,0,0), (0.14,0,0), (0,0.13,0)],
[(0.40,1.0,0), (0.26,-0.2,0), (0,-0.13,0)],
[(0,0.8,0), (0.26,0.2,0), (0,-0.13,0)],
[(0,0.2,0), (0.26,-0.2,0), (0,0.13,0)],
[(0.40,0,0), (0.26,0.2,0), (0,0.13,0)],
[(0.53,0.2,0), (0,0.6,0), (0.13,0,0)],
(0.78,0,0)],
'1': [[(0.22,0,0), (0.13,0,0), (0,1.0,0)],
[(0,0.66,0), (0,0.16,0), (0.22,0.18,0)],
(0.78,0,0)],
'2': [[(0,0,0), (0.66,0,0), (0,0.12,0)],
[(0,0.12,0), (0.53,0.64,0), (0.13,0,0)],
[(0.53,0.76,0), (0.12,0,0), (0,0.10,0)],
[(0.53,0.86,0), (0.12,0,0), (-0.14,0.14,0)],
[(0.51,1.0,0), (-0.34,0,0), (0,-0.12,0)],
[(0.03,0.76,0), (0,0.10,0), (0.12,0,0)],
[(0.03,0.86,0), (0.12,0,0), (0.14,0.14,0)],
(0.78,0,0)],
'3': [[(0,0.33,0), (0.12,0,0), (0,-0.12,0)],
[(0,0.21,0), (0.12,0,0), (0.14,-0.21,0)],
[(0.14,0,0), (0.34,0,0), (0,0.12,0)],
[(0.53,0.21,0), (0.13,0,0), (0,0.18,0)],
[(0.66,0.21,0), (-0.13,0,0), (-0.14,-0.21,0)],
[(0.53,0.39,0), (0.13,0,0), (-0.13,0.19,0)],
[(0.26,0.53,0), (0.24,0,0), (0,0.10,0)],
[(0.52,0.70,0), (0.12,0,0), (-0.12,-0.12,0)],
[(0.52,0.86,0), (0.12,0,0), (0,-0.16,0)],
[(0.52,0.86,0), (0.12,0,0), (-0.14,0.14,0)],
[(0.50,1.0,0), (-0.33,0,0), (0,-0.12,0)],
[(0.03,0.76,0), (0,0.10,0), (0.12,0,0)],
[(0.03,0.86,0), (0.12,0,0), (0.14,0.14,0)],
(0.78,0,0)],
'4': [[(0.42,0,0), (0.13,0,0), (0,1.0,0)],
[(0,0.34,0), (0.69,0,0), (0,0.10,0)],
[(0,0.34,0), (0.42,0.51,0), (0,0.14,0)],
(0.78,0,0)],
'5': [[(0,0.33,0), (0.12,0,0), (0,-0.12,0)],
[(0,0.21,0), (0.12,0,0), (0.14,-0.21,0)],
[(0.14,0,0), (0.34,0,0), (0,0.12,0)],
[(0.53,0.21,0), (0.13,0,0), (0,0.22,0)],
[(0.66,0.21,0), (-0.13,0,0), (-0.14,-0.21,0)],
[(0.66,0.43,0), (-0.13,0,0), (-0.13,0.19,0)],
[(0.20,0.52,0), (0.28,0,0), (0,0.10,0)],
[(0.04,0.46,0), (0.11,-0.01,0), (0.16,0.16,0)],
[(0.04,0.46,0), (0.11,-0.01,0), (0.07,0.54,0)],
[(0.11,1.0,0), (0.50,0,0), (0,-0.11,0)],
(0.78,0,0)],
'6': [[(0,0.21,0), (0.13,0,0), (0,0.58,0)],
[(0,0.21,0), (0.13,0,0), (0.18,-0.21,0)],
[(0.18,0,0), (0.30,0,0), (0,0.12,0)],
[(0,0.43,0), (0.13,0,0), (0.18,0.21,0)],
[(0.53,0.21,0), (0.13,0,0), (0,0.22,0)],
[(0.66,0.21,0), (-0.13,0,0), (-0.18,-0.21,0)],
[(0.66,0.43,0), (-0.13,0,0), (-0.18,0.21,0)],
[(0.20,0.54,0), (0.28,0,0), (0,0.10,0)],
[(0,0.79,0), (0.18,0.21,0), (0.13,0,0)],
[(0.18,1.0,0), (0.30,0,0), (0,-0.13,0)],
[(0.66,0.79,0), (-0.13,0,0), (-0.18,0.21,0)],
(0.78,0,0)],
'7': [[(0,1.0,0), (0.66,0,0), (0,-0.12,0)],
[(0.27,0,0), (-0.14,0,0), (0.39,0.88,0)],
(0.78,0,0)],
'8': [[(0,0.21,0), (0.13,0,0), (0,0.22,0)],
[(0,0.21,0), (0.13,0,0), (0.18,-0.21,0)],
[(0.18,0,0), (0.30,0,0), (0,0.12,0)],
[(0,0.43,0), (0.13,0,0), (0.18,0.21,0)],
[(0.53,0.21,0), (0.13,0,0), (0,0.22,0)],
[(0.66,0.21,0), (-0.13,0,0), (-0.18,-0.21,0)],
[(0.66,0.43,0), (-0.13,0,0), (-0.18,0.21,0)],
[(0.20,0.54,0), (0.28,0,0), (0,0.10,0)],
[(0.05,0.79,0), (0.18,0.21,0), (0.13,0,0)],
[(0.23,1.0,0), (0.20,0,0), (0,-0.13,0)],
[(0.61,0.79,0), (-0.13,0,0), (-0.18,0.21,0)],
[(0.05,0.79,0), (0.13,0,0), (0,-0.1,0)],
[(0.61,0.79,0), (-0.13,0,0), (0,-0.1,0)],
[(0.05,0.69,0), (0.13,0,0), (0.10,-0.1,0)],
[(0.61,0.69,0), (-0.13,0,0), (-0.10,-0.1,0)],
(0.78,0,0)],
'9': [[(0.78, 0.79, 0), (-0.13, 0, 0), (0, -0.58, 0)],
[(0.78, 0.79, 0), (-0.13, 0, 0), (-0.18, 0.21, 0)],
[(0.6, 1.0, 0), (-0.3, 0, 0), (0, -0.12, 0)],
[(0.78, 0.57, 0), (-0.13, 0, 0), (-0.18, -0.21, 0)],
[(0.25, 0.79, 0), (-0.13, 0, 0), (0, -0.22, 0)],
[(0.12, 0.79, 0), (0.13, 0, 0), (0.18, 0.21, 0)],
[(0.12, 0.57, 0), (0.13, 0, 0), (0.18, -0.21, 0)],
[(0.58, 0.46, 0), (-0.28, 0, 0), (0, -0.1, 0)],
[(0.78, 0.21, 0), (-0.18, -0.21, 0), (-0.13, 0, 0)],
[(0.6, 0.0, 0), (-0.3, 0, 0), (0, 0.13, 0)],
[(0.12, 0.21, 0), (0.13, 0, 0), (0.18, -0.21, 0)],
(0.78,0,0)],
'-': [[(0.01,0.34,0), (0,0.13,0), (0.34,0,0)],
(0.44,0,0)],
'+': [[(0,0.32,0), (0,0.10,0), (0.70,0,0)],
[(0.30,0.03,0), (0,0.70,0), (0.10,0,0)],
(0.81,0,0)],
'.': [[(0.05,0,0), (0.14,0,0), (0,0.14,0)],
(0.38,0,0)],
':': [[(0.05,0,0), (0.14,0,0), (0,0.14,0)],
[(0.05,0.58,0), (0.14,0,0), (0,0.14,0)],
(0.38,0,0)],
'*': [[(0,0.82,0), (0.025,0.07,0), (0.21,-0.06,0)],
[(0.43,0.82,0), (-0.025,0.07,0), (-0.22,-0.06,0)],
[(0.17,0.98,0), (0.08,0,0), (0,-0.20,0)],
[(0.06,0.64,0), (0.06,-0.05,0), (0.12,0.16,0)],
[(0.36,0.64,0), (-0.06,-0.05,0), (-0.12,0.16,0)],
(0.53,0,0)]
}
def getlength(str):
dx = 0
for char in str:
if letters.has_key(char):
data = letters[char]
else:
data = letters['*']
# assume that increment in char description is always of form (dx,0,0)
dx = dx+data[-1][0]
return dx
class text(object):
def __init__(self, pos=(0,0,0), axis=defaultdir, string='', justify='left',
height=1.0, width=None, depth=0, color=None, up=None, visible=1, **keywords):
if keywords.has_key('display'):
self.display = keywords['display']
else:
self.display = display.get_selected()
axis = norm(vector(axis))
pos = vector(pos)
height = float(height)
if width == None:
width = height
width = float(width)
depth = float(depth)
self.frame = frame(pos=pos, axis=axis)
if up is not None:
self.frame.up = up
self.__visible = visible
self.string = string
self.justify = justify
self.height = height
self.width = width
self.depth = depth
self.color = color
self.objects = []
if justify == 'right':
origin = vector(-width*getlength(string),0.,0.)
elif justify == 'center':
origin = vector(-width*getlength(string)/2.,0.,0.)
else:
origin = vector(0.,0.,0.)
for char in string:
origin = self.showletter(origin, char)
def makeletterbox(self, origin, b):
barray = array(b)
ab = barray*array((self.width,self.height,0.))
org = origin+ab[0]
b = convex(display=self.display, color=self.color, frame=self.frame, visible=self.__visible)
self.objects.append(b)
if self.depth != 0:
for i in range(2):
for j in range(2):
for k in range(2):
# print org + i*ab[1] + j*ab[2] + k*vector(0.,0.,xsize*thickness)).__class__
b.append(pos=(org + i*ab[1] + j*ab[2] + k*vector(0.,0.,self.width*self.depth)))
else:
for i in range(2):
for j in range(2):
b.append(pos=(org + i*ab[1] + j*ab[2]))
def showletter(self, origin, char):
if letters.has_key(char):
data = letters[char]
else:
data = letters['*']
for n in range(len(data)-1):
self.makeletterbox(origin, data[n])
# assume that increment in char description is always of form (dx,0,0)
dx = data[-1][0]
return origin+self.width*dx*defaultdir
def reshape(self, pos=None, height=None, width=None, color=None):
if pos is not None:
self.frame.pos = pos
if height is None:
height = self.height
if width is None:
width = self.width
if color is None:
color = self.color
xratio = width/self.width
yratio = height/self.height
# print array((xratio,yratio,0.))
for obj in self.objects:
obj.pos = obj.pos*array((xratio,yratio,1.))
obj.color = color
self.height = float(height)
self.width = float(width)
self.color = color
def makeinvisible(self): # kept for backward compatibility
for obj in self.objects:
obj.visible = 0
def _get_visible(self):
return self.__visible
def _set_visible(self,visible):
self.__visible = visible
# Starting with Visual 4.0, frame.visible affects all
# objects in a frame, as it should (but didn't use to).
# For backward compatibility, set visible attributes for
# all objects in the frame in the following awkward manner:
for obj in self.objects:
obj.visible = visible
visible = property( _get_visible, _set_visible, None)
if __name__ == '__main__':
scene.title = "3D Text"
scene.fov = 0.001
scene.range = 7
arrow(pos=(-4,3.5,0), axis=(2.5,0,0), color=color.green)
text(pos=(0,3,0), string='ABC', color=color.red, depth=0.3, justify='center')
text(pos=(0,-3,0), string='DEF', color=color.blue, depth=0.3, justify='center')
message = text(pos=(0,0,0), string='CLICK TO CHANGE THIS', justify='center',
color=color.yellow, axis=(1,0,1),
depth=0.3, up=(0,1,-0.3))
scene.mouse.getclick()
message.reshape(color=color.cyan, height=2)
scene.mouse.getclick()
message.visible = 0
|