For those who want to use transparency in a screenshot.
render_window = vtk.vtkRenderWindow()
render_window.AddRenderer(renderer)
render_window.SetAlphaBitPlanes(1) # Enable usage of alpha channel
...
w2if = vtk.vtkWindowToImageFilter()
w2if.SetInput(render_win)
w2if.SetInputBufferTypeToRGBA() # Also record the alpha (transparency) channel
...
More details in this official vtk example.
Edit: In addition, if the above is not working (e.g. the background is transparent but the actors are white/not rendered properly), you can try to enable depth peeling.
Before the above code snippet you should add
# the renderer, as in the question
renderer = vtk.vtkRenderer()
renderer.AddActor(actor)
renderer.SetBackground(0,255,0)
renderer.SetBackgroundAlpha(0.2) # add background opacity value
renderer.SetUseDepthPeeling(1) # only works with current GPUs
renderer.SetOcclusionRatio(0.2) # 0. is better, but much slower
You might also need to increase the maximum number of peels (default is 4). Check this VTK Wiki page for more details.