Display Text in Slice view

The code above works well for me - displays text in 3D view as expected.

To display text in slice views, replace the first line by this line:

view = slicer.app.layoutManager().sliceWidget("Red").sliceView()

You may consider hiding slice view annotations, to prevent them from overwriting the text you place there. See example.