Changeset 3873 for anuga_core/source/anuga/visualiser/offline.py
- Timestamp:
- Oct 26, 2006, 1:02:41 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/visualiser/offline.py
r3670 r3873 1 1 from Numeric import array, Float, ravel, zeros 2 2 from Scientific.IO.NetCDF import NetCDFFile 3 from Tkinter import Button, E, W3 from Tkinter import Button, E, Tk, W 4 4 from visualiser import Visualiser 5 5 from vtk import vtkCellArray, vtkPoints, vtkPolyData … … 13 13 structures for any dynamic height based quantities to render. 14 14 """ 15 def __init__(self, source ):15 def __init__(self, source, frameDelay=100): 16 16 """The source parameter is assumed to be a NetCDF sww file. 17 The frameDelay parameter is the number of milliseconds waited between frames. 17 18 """ 18 19 Visualiser.__init__(self, source) … … 22 23 self.maxFrameNumber = fin.variables['time'].shape[0] - 1 23 24 fin.close() 25 26 self.frameDelay = frameDelay 24 27 25 28 self.xmin = None … … 140 143 141 144 def run(self): 142 self. tk_root.after(100, self.animateForward)145 self.alter_tkroot(Tk.after, (self.frameDelay, self.animateForward)) 143 146 Visualiser.run(self) 144 147 145 148 def restart(self): 146 149 self.frameNumber = 0 147 self.redraw_quantities( True)150 self.redraw_quantities() 148 151 self.pause() 149 152 … … 153 156 else: 154 157 self.frameNumber = 0 155 self.redraw_quantities( True)158 self.redraw_quantities() 156 159 self.pause() 157 160 … … 159 162 if self.frameNumber > 0: 160 163 self.frameNumber -= 1 161 self.redraw_quantities( True)164 self.redraw_quantities() 162 165 self.pause() 163 166 … … 175 178 self.paused = False 176 179 self.tk_pauseResume.config(text="Pause") 177 self.tk_root.after( 100, self.animateForward)180 self.tk_root.after(self.frameDelay, self.animateForward) 178 181 179 182 def forward(self): … … 184 187 if self.frameNumber < self.maxFrameNumber: 185 188 self.frameNumber += 1 186 self.redraw_quantities( True)189 self.redraw_quantities() 187 190 else: 188 191 self.pause() … … 193 196 else: 194 197 self.frameNumber = self.maxFrameNumber 195 self.redraw_quantities( True)198 self.redraw_quantities() 196 199 self.pause() 197 200 … … 199 202 if self.paused is not True: 200 203 self.forward_step() 201 self.tk_root.after( 100, self.animateForward)204 self.tk_root.after(self.frameDelay, self.animateForward)
Note: See TracChangeset
for help on using the changeset viewer.