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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1384 - (show annotations)
Fri Jan 11 02:29:38 2008 UTC (11 years, 1 month ago) by phornby
Original Path: temp_trunk_copy/doc/examples/pyvisi/text.py
File MIME type: text/x-python
File size: 1101 byte(s)
Make a temp copy of the trunk before checking in the windows changes


1 """
2 Author: John Ngui, john.ngui@uq.edu.au
3 """
4
5 # Import the necessary modules.
6 from esys.pyvisi import Scene, Text2D, LocalPosition
7 from esys.pyvisi.constant import *
8 import os
9
10 PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
11 PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
12 X_SIZE = 600
13 Y_SIZE = 600
14
15 IMAGE_NAME = "text.jpg"
16 JPG_RENDERER = Renderer.ONLINE_JPG
17
18 # Create a Scene.
19 s = Scene(renderer = JPG_RENDERER, num_viewport = 4, x_size = X_SIZE,
20 y_size = Y_SIZE)
21
22 # Create a 2D text for the first viewport.
23 t1 = Text2D(scene = s, text = "VTK ...", viewport = Viewport.SOUTH_WEST)
24 t1.setPosition(LocalPosition(x_coor = 20, y_coor = 30))
25 t1.setColor(color = Color.BLUE)
26 t1.setFontSize(size = 20)
27 t1.boldOn()
28
29 # Create a 2D text for the third viewport.
30 t2 = Text2D(scene = s, text = "PYTHON ...\n MESH",
31 viewport = Viewport.NORTH_EAST)
32 t2.setPosition(LocalPosition(x_coor = 20, y_coor = 30))
33 t2.setColor(color = Color.PURPLE)
34 t2.setFontSize(size = 50)
35 t2.setFontToArial()
36 t2.shadowOn()
37
38 # Render the object.
39 s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, IMAGE_NAME))
40

  ViewVC Help
Powered by ViewVC 1.1.26