Another option would be to create a start_event_loop function like Paul
suggested and overload that function in those backends that aren't
interactive so that it returns an error, but this requires writing one
such function for each non-interactive backend.
Either create a deeper hierarchy:
FigureCanvasBase:
def start_event_loop(self, ...):
raise NotImplemented
FigureCanvasInteractive:
def start_event_loop(self, ...):
generic interactive using time.sleep
MyInteractiveBackend(FigureCanvasInteractive):
def start_event_loop(self, ...):
specialized interactive code using GUI
or a mix-in class:
FigureCanvasBase:
def start_event_loop(self, ...):
raise NotImplemented
FigureCanvasEventLoopMixin:
def start_event_loop(self, ...):
generic interactive using time.sleep
MyInteractiveBackend(FigureCanvasBase,FigureCanvasEventLoopMixin):
... no start_event_loop since using the generic mixin ...
I prefer the latter, particularly since it won't be needed once the
existing interactive backends are implemented.
Also, is there any case
where an event loop would be useful for a graphically non-interactive
backend? If so, this would again mean that this problem would be easier
to deal with once in the Blocking* classes.
No reason to. While you could prompt for graph coordinates at the
command line on a call to ginput, you could also simply prompt for
the coordinates without bothering with ginput.
- Paul
···
On Thu, Jul 17, 2008 at 09:44:48PM +0200, David M. Kaplan wrote: