# How to put a text in the center of a renderview?

**URL:** https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304
**Category:** ParaView Support
**Created:** [September 9, 2020, 1:03pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304 "2020-09-09T13:03:44Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![sharaborin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sharaborin](https://discourse.paraview.org/u/sharaborin)
#### Post date: [September 9, 2020, 1:03pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/1 "2020-09-09T13:03:44Z")

</div>

Dear All,

I am trying to put a text in the center of the renderview on the specific height Oy, not center bottom. How to do it?  
I am using pvpython. setting position is not suitable, because I don’t know the length

BR,  
Evgenii

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 9, 2020, 1:17pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/2 "2020-09-09T13:17:05Z")

</div>

- Source -\> Text, Apply
- check “Lower left corner” and position the text

---

<div class="post-metadata">

### Author: ![sharaborin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sharaborin](https://discourse.paraview.org/u/sharaborin)
#### Post date: [September 9, 2020, 2:47pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/3 "2020-09-09T14:47:18Z")

</div>

Dear Mathieu,

Yes indeed, I will able to specify position, but the position corresponds to the lower-left corner. I need to specify the position according to the center of the text.  
I want to automate the generation of pictures with some data on them.

BR,  
Evgenii

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 9, 2020, 2:49pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/4 "2020-09-09T14:49:28Z")

</div>

You will need to recover the 2D bounds of your text actor, may be doable in Python.

---

<div class="post-metadata">

### Author: ![sharaborin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sharaborin](https://discourse.paraview.org/u/sharaborin)
#### Post date: [September 9, 2020, 2:55pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/5 "2020-09-09T14:55:23Z")

</div>

I tryed this to get bounds info: but it does not work:

> ```
> text1 = Text()
> text1.Text = 'x=' + str(round(sl,2)) + " l/l_b=" + str(round((sl-bounds[0])/len_bub,2))
> 
> text1Display = Show(text1, renderView2, 'TextSourceRepresentation')
> 
> # trace defaults for the display properties.
> text1Display.WindowLocation = 'AnyLocation'
> text1Display.Position = [0.3, 0.2]
> textBounds = text1.GetDataInformation().GetBounds()
> print("textBounds=",textBounds)
> 
> ```

It shows  
` ('textBounds=', (1e+299, -1e+299, 1e+299, -1e+299, 1e+299, -1e+299))`

BR,  
Evgenii

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 15, 2020, 2:44pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/6 "2020-09-15T14:44:01Z")

</div>

```
Text()
rep=Show()
Render()
rep.Position2
```

---

<div class="post-metadata">

### Author: ![sharaborin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@sharaborin](https://discourse.paraview.org/u/sharaborin)
#### Post date: [September 23, 2020, 7:00am UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/7 "2020-09-23T07:00:56Z")

</div>

Dear Mathieu,

I have tried this but it shows the same number for any text.

then I tried another to find out the width of a text:

```
text1=Text()
text1.Text="my text"
text1Display = Show(text1)
text1Display.WindowLocation = 'UpperCenter';
Render()
print text1Display.Position2, text1Display.Position

```

the output is

```
<paraview.servermanager.RenderView object at 0x12689b650>

[0.1, 0.1] [0.05, 0.05]

```

The outout is not correct.

BR,  
Evgenii

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 23, 2020, 11:13am UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/8 "2020-09-23T11:13:32Z")

</div>

It looks like this is not updated properly, this is a bug.

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [September 23, 2020, 5:03pm UTC](https://discourse.paraview.org/t/how-to-put-a-text-in-the-center-of-a-renderview/5304/9 "2020-09-23T17:03:57Z")

</div>

Replicated. Reported here: [https://gitlab.kitware.com/paraview/paraview/-/issues/20226](https://gitlab.kitware.com/paraview/paraview/-/issues/20226)
