I have the following problem with my application, which allows
manipulate some of properties of a plot through the use of a
Whenever I set the y-axis scale to logarithmic, but have the y
include a negative value, I will get a ValueError upon
bad thing is now, that my application catches all exceptions
displays a user-friendly dialog, explaining or listing the
offering the user to mail the output to the dumb author of the
But whenever the user quits the dialog, a new expose event of
will be triggered, leading to an unstoppable series of
(except when using xkill of course).
So what I would like to propose is a modification of
located in backends/backend_gtk.py to better handle any
it might trigger.
One not so nice solution of mine was to wrap the method in a
try...finally statement, which ensures that False is returned
expose_event is stopped:
def expose_event(self, widget, event):
"""Expose_event for all GTK backends. Should not be
if _debug: print 'FigureCanvasGTK.%s' % fn_name()
x, y, w, h = self.allocation
self._pixmap_prepare (w, h)
self._render_figure(self._pixmap, w, h)
self._need_redraw = False
x, y, w, h = event.area
self._pixmap, x, y, x, y, w, h)
return False # finish event propagation?
Of course, this has the obvious disadvantage, that no
triggered at all, which is undesirable.
I don't understand, the exception is still raised after the 'finally'
Are there any better approaches to this?
You could simply popup the user-friendly dialog and then kill the
program after the user has read the message and clicked "OK".
When you use semilogy(), matplotlib ignores the values <= 0 (I'm not
sure where the code is that does that), I think an application should do
If we add try ... finally to expose_event() that would mean we are
handling application errors within library code, which I don't think is
right. Also, this problem would affect all backends so it would probably
be better to handle it (if it is needed) in the Figure.draw() rather
than having to modify every backend.
Send instant messages to your online friends http://au.messenger.yahoo.com
On Tue, 2006-04-18 at 20:11 -0700, email@example.com wrote: