How to insert timestep-varying text annotation into paraview by python scripting

Hi, I have 10 vtk files for velocity in time series and apply python script to read them in paraview. Now I want to add simulation time in the render view for these 10 time steps. The Annotation Time Filter doesn’t work because it generates text annotation like time=00001, time=00002, … But what I want is time=0.05, time=0.10, …

I have obtain the variable time, which is a dictionary, looks like:

{0: '0.5', 1: '1.0', 2: '1.5', 3: '2.0', 4: '2.5', 5: '3.0', 6: '3.5', 7: '4.0', 8: '4.5', 9: '5.0'}

For now, I am trying to achieve this goal by two methods.

1. Source → Text

SetActiveSource(U)      
text1 = Text()                                                  
text1.Text = time           # ???
text1Display = Show(text1, renderView1)  

And I receive “RuntimeError: This property requires 1 values.”. The error is that the variable time has 10 elements but they can not be applied to 10 vtk files respectively. Does anyone know how to add dynamic text function changing with time step in paraview?

2. Filter → Python Annotation

pythonAnnotation1 = PythonAnnotation(Input=U)
pythonAnnotation1.Expression = "time[t_index]"  # ???
pythonAnnotation1Display = Show(pythonAnnotation1, renderView1) 

The error is “NameError: name ‘time’ is not defined”. I think the problem is similar with method 1. Although I define variable “time” in python scripting, but I still need to pass it into paraview so that the Python Annotation Filter can identify it.
Here, the question converts into two possibilities:
(1) is it possible to insert the variable “time” (with the format of csv? txt?) in paraview so that Python Annotation Filter can use it.
(2) is it possible to generate the variable “time” in paraview using some programmable tools (like Programmable Source? Programmable Filter?) and then apply Python Annotation Filter.

I have stuck here for a few days, if someone can give me help, that would be great! Thanks!

You could create a source “3D text” and edit each one to the desired time data, and save as time-01.vtk, time02.vtk etc - then when you load it in as a series of files, it should change the text automatically when you press play…?

There is a dedicated source for that, “Annotate Time”

Oh - perfect!
Thanks Matt.