text.py :  » Game-2D-3D » Visual » visual-5.32_release » site-packages » visual » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Game 2D 3D » Visual 
Visual » visual 5.32_release » site packages » visual » text.py
from visual import *

# This early 3D text machinery is limited to rather crude uppercase letters.
# It has been superceded by the text object introduced in Visual 5.3.

__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

    


www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.