# Troubleshooting a render window not showing up.

**URL:** https://discourse.vtk.org/t/troubleshooting-a-render-window-not-showing-up/14256
**Category:** Support
**Created:** [July 18, 2024, 6:43pm UTC](https://discourse.vtk.org/t/troubleshooting-a-render-window-not-showing-up/14256 "2024-07-18T18:43:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)
#### Post date: [July 18, 2024, 6:43pm UTC](https://discourse.vtk.org/t/troubleshooting-a-render-window-not-showing-up/14256/1 "2024-07-18T18:43:14Z")

</div>

I usually output to file, so if this is obvious, my apologies.

I can copy-paste [this example](https://examples.vtk.org/site/Python/GeometricObjects/Cone/), and it works just fine: a window pops up with a cone in it. I tried to simplify it a bit and run it, and this code exits immediately, with no window shown and no error?

```python
from vtkmodules.vtkFiltersSources import vtkConeSource
from vtkmodules.vtkInteractionStyle import vtkInteractorStyleTrackballCamera
from vtkmodules.vtkRenderingCore import (
    vtkActor,
    vtkPolyDataMapper,
    vtkRenderer,
    vtkRenderWindow,
    vtkRenderWindowInteractor)

t = vtkConeSource()
mapper = vtkPolyDataMapper()
mapper.SetInputConnection(t.GetOutputPort())
actor = vtkActor()
actor.SetMapper(mapper)

ren = vtkRenderer()
ren.AddActor(actor)
ren_win = vtkRenderWindow()
ren_win.AddRenderer(ren)
ren_win.SetSize(640, 480)
ren_win.SetWindowName("Test")
iren = vtkRenderWindowInteractor()
iren.SetRenderWindow(ren_win)

ren_win.Render()
iren.Start()

```

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [July 18, 2024, 7:02pm UTC](https://discourse.vtk.org/t/troubleshooting-a-render-window-not-showing-up/14256/2 "2024-07-18T19:02:57Z")

</div>

Add these, they are the modules that contain the platform-specific implementions of vtkRenderWindow and vtkRenderWindowInteractor:

```python
import vtkmodules.vtkRenderingOpenGL2
import vtkmodules.vtkRenderingUI

```

Without these, calling `vtkRenderWindow()` and `vtkRenderWindowInteractor()` creates objects that can’t render or interact because they can’t talk to the display.

But after importing e.g. vtkRenderingOpenGL2, `vtkRenderWindow()` will return an instance of the appropriate vtkRenderWindow subclass for rendering with OpenGL on your operating system. This is due to VTK’s factory mechanism. It’s a “feature” of VTK that you can override vtkRenderWindow by dynamically importing a module.

---

<div class="post-metadata">

### Author: ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)
#### Post date: [July 18, 2024, 7:10pm UTC](https://discourse.vtk.org/t/troubleshooting-a-render-window-not-showing-up/14256/3 "2024-07-18T19:10:38Z")

</div>

Ok - adding those two imports caused my script above to work. I tried it again with only `import vtkmodules.vtkRenderingOpenGL2` and that worked as well.

Thanks
