191 | | To be done |
192 | | |
| 191 | Also a Python script can be used in an animation cue. In the Python script three functions can be implemented: |
| 192 | * start_cue: is executed once at the beginning of the animation |
| 193 | * tick: is executed every time step |
| 194 | * end_cue: is executed once at the end of the animation |
| 195 | |
| 196 | Here is an example of such a script. In this example the value of the timestep is translated into a date string (e.g. 2018-01-01) and displayed in the scene via a text source with name "Text1". |
| 197 | {{{ |
| 198 | #!python |
| 199 | from paraview.simple import * |
| 200 | from datetime import date |
| 201 | from datetime import timedelta |
| 202 | |
| 203 | def start_cue(self): pass |
| 204 | |
| 205 | def tick(self): |
| 206 | view = GetActiveView() |
| 207 | time = int(view.ViewTime) |
| 208 | dat = date(2000,1,1) + timedelta(days=time) |
| 209 | tx = FindSource("Text1") |
| 210 | tx.Text = repr(dat.year) + "-" + '{:02d}'.format(dat.month) + "-" + '{:02d}'.format(dat.day) |
| 211 | |
| 212 | def end_cue(self): pass |
| 213 | }}} |