Last change
on this file since 3512 was
3493,
checked in by jack, 18 years ago
|
Offline visualiser is working fairly well.
|
File size:
1.3 KB
|
Line | |
---|
1 | from Tkinter import Button |
---|
2 | from visualiser import Visualiser |
---|
3 | |
---|
4 | class RealtimeVisualiser(Visualiser): |
---|
5 | """A VTK-powered realtime visualiser which runs in its own thread. |
---|
6 | """ |
---|
7 | def __init__(self, source): |
---|
8 | """The source parameter is assumed to be a Domain. |
---|
9 | """ |
---|
10 | Visualiser.__init__(self, source) |
---|
11 | |
---|
12 | self.running = True |
---|
13 | |
---|
14 | # Synchronisation Constructs |
---|
15 | self.sync_idle = Event() |
---|
16 | self.sync_idle.clear() |
---|
17 | self.sync_unpaused = Event() |
---|
18 | self.sync_unpaused.set() |
---|
19 | self.sync_redrawReady = Event() |
---|
20 | self.sync_redrawReady.clear() |
---|
21 | |
---|
22 | def run(self): |
---|
23 | Visualiser.run(self) |
---|
24 | self.tk_root.after(100, self.sync_idle.set) |
---|
25 | |
---|
26 | def setup_gui(self): |
---|
27 | Visualiser.setup_gui(self) |
---|
28 | self.tk_pauseResume = Button(self.tk_root, text="Pause", command=self.pauseResume) |
---|
29 | self.tk_pauseResume.grid(row=1, column=0) |
---|
30 | |
---|
31 | def pauseResume(self): |
---|
32 | if self.sync_unpaused.isSet(): |
---|
33 | self.sync_unpaused.clear() |
---|
34 | self.tk_pauseResume.config(text="Resume") |
---|
35 | else: |
---|
36 | self.sync_unpaused.set() |
---|
37 | self.tk_pauseResume.config(text="Pause") |
---|
38 | |
---|
39 | def shutdown(self): |
---|
40 | Visualiser.shutdown(self) |
---|
41 | self.running = False |
---|
42 | self.sync_idle.set() |
---|
43 | self.sync_unpaused.set() |
---|
Note: See
TracBrowser
for help on using the repository browser.