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