/[escript]/trunk/doc/examples/pyvisi/text.py
ViewVC logotype

Annotation of /trunk/doc/examples/pyvisi/text.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1148 - (hide annotations)
Wed May 16 22:45:33 2007 UTC (11 years, 9 months ago) by jongui
File MIME type: text/x-python
File size: 1053 byte(s)
Added the updated files for pyvisi and removed some incorrect reference images.
1 ksteube 1147 # Import the necessary modules.
2     from esys.pyvisi import Scene, Text2D, LocalPosition
3     from esys.pyvisi.constant import *
4 jongui 1148 import os
5 ksteube 1147
6 jongui 1148 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
7     PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
8 ksteube 1147 X_SIZE = 600
9     Y_SIZE = 600
10    
11     IMAGE_NAME = "text.jpg"
12     JPG_RENDERER = Renderer.ONLINE_JPG
13    
14     # Create a Scene.
15     s = Scene(renderer = JPG_RENDERER, num_viewport = 4, x_size = X_SIZE,
16     y_size = Y_SIZE)
17    
18     # Create a 2D text for the first viewport.
19     t1 = Text2D(scene = s, text = "VTK ...", viewport = Viewport.SOUTH_WEST)
20     t1.setPosition(LocalPosition(x_coor = 20, y_coor = 30))
21     t1.setColor(color = Color.BLUE)
22     t1.setFontSize(size = 20)
23     t1.boldOn()
24    
25     # Create a 2D text for the third viewport.
26     t2 = Text2D(scene = s, text = "PYTHON ...\n MESH",
27     viewport = Viewport.NORTH_EAST)
28     t2.setPosition(LocalPosition(x_coor = 20, y_coor = 30))
29     t2.setColor(color = Color.PURPLE)
30     t2.setFontSize(size = 50)
31     t2.setFontToArial()
32     t2.shadowOn()
33    
34     # Render the object.
35 jongui 1148 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
36 ksteube 1147

  ViewVC Help
Powered by ViewVC 1.1.26