# TextureMapToSphere in Python Plugin

**URL:** https://discourse.paraview.org/t/texturemaptosphere-in-python-plugin/7798
**Category:** Development
**Tags:** python
**Created:** [August 11, 2021, 1:35am UTC](https://discourse.paraview.org/t/texturemaptosphere-in-python-plugin/7798 "2021-08-11T01:35:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Jared\_Blanchard](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jared_blanchard/32/7174_2.png) [@Jared\_Blanchard](https://discourse.paraview.org/u/Jared_Blanchard)
#### Post date: [August 11, 2021, 1:35am UTC](https://discourse.paraview.org/t/texturemaptosphere-in-python-plugin/7798/1 "2021-08-11T01:35:19Z")

</div>

I would like to display a texture maps on spheres as part of a new source class, `PythonSolarSystemSource`. The plugin currently creates 8 `vtkSphereSource()` objects and animates them in orbit about the origin. I can manually go in to the display and add texture maps to each of these, but I would like to have that automated in the plugin. I can create an instance of `vtkTextureMapToSphere()` and add a `vtkSphereSource()` as an input connection like this.

```auto
self.sphere = vtkSphereSource()
self.texture = vtkTextureMapToSphere()
self.texture.AddInputConnection(self.sphere.GetOutputPort())

```

When I output the texture map I see a copy of the input sphere.

```auto
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
output = vtkMultiBlockDataSet.GetData(outInfo, 0)
output.SetBlock(0, self.sphere.GetOutput())
output.SetBlock(1, self.texture.GetOutput())

```

However, I can’t figure out how to add an image to the texture map and have it display. I’ve tried using `vtkJPEGReader()` and `vtkTexture()` objects, but I can’t add them as input connections to the `vtkTextureMapToSphere()` object.

I’ve realized in the GUI the texture map file is selected in the Display tab. Can I access the display tab from a python plugin? Any hints?

---

<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: [August 11, 2021, 7:42am UTC](https://discourse.paraview.org/t/texturemaptosphere-in-python-plugin/7798/2 "2021-08-11T07:42:42Z")

</div>

This can’t be done, you need to do that from ParaView itself, which can be scripted if needed.

---

<div class="post-metadata">

### Author: ![Jared\_Blanchard](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jared_blanchard/32/7174_2.png) [@Jared\_Blanchard](https://discourse.paraview.org/u/Jared_Blanchard)
#### Post date: [August 11, 2021, 2:04pm UTC](https://discourse.paraview.org/t/texturemaptosphere-in-python-plugin/7798/3 "2021-08-11T14:04:18Z")

</div>

I was afraid of that. Ok, thank you!
