Dear all,
I'm using matplotlib together with ipython --pylab and have a plot open and can select/deselect points there with the picker and they toggle between o and x. When I do that my matplotlib running under Leopard 10.5.6 and MacOSX backend raises an exception:
···
------------------------------------
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/backend_bases.pyc in button_press_event(self, x, y, button, guiEvent)
1147 s = 'button_press_event'
1148 mouseevent = MouseEvent(s, self, x, y, button, self._key, guiEvent=guiEvent)
-> 1149 self.callbacks.process(s, mouseevent)
1150
1151 def button_release_event(self, x, y, button, guiEvent=None):
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/cbook.pyc in process(self, s, *args, **kwargs)
153 self._check_signal(s)
154 for func in self.callbacks[s].values():
--> 155 func(*args, **kwargs)
156
157
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/backend_bases.pyc in pick(self, mouseevent)
1052 def pick(self, mouseevent):
1053 if not self.widgetlock.locked():
-> 1054 self.figure.pick(mouseevent)
1055
1056 def blit(self, bbox=None):
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/artist.pyc in pick(self, mouseevent)
271 # Pick children
272 for a in self.get_children():
--> 273 a.pick(mouseevent)
274
275 def set_picker(self, picker):
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/axes.pyc in pick(self, *args)
2483 raise DeprecationWarning('New pick API implemented -- '
2484 'see API_CHANGES in the src distribution')
-> 2485 martist.Artist.pick(self,args[0])
2486
2487 def __pick(self, x, y, trans=None, among=None):
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/artist.pyc in pick(self, mouseevent)
271 # Pick children
272 for a in self.get_children():
--> 273 a.pick(mouseevent)
274
275 def set_picker(self, picker):
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/artist.pyc in pick(self, mouseevent)
267 inside,prop = self.contains(mouseevent)
268 if inside:
--> 269 self.figure.canvas.pick_event(mouseevent, self, **prop)
270
271 # Pick children
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/backend_bases.pyc in pick_event(self, mouseevent, artist, **kwargs)
1113 s = 'pick_event'
1114 event = PickEvent(s, self, mouseevent, artist, **kwargs)
-> 1115 self.callbacks.process(s, event)
1116
1117 def scroll_event(self, x, y, step, guiEvent=None):
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/cbook.pyc in process(self, s, *args, **kwargs)
153 self._check_signal(s)
154 for func in self.callbacks[s].values():
--> 155 func(*args, **kwargs)
156
157
/Users/wkerzend/scripts/python/pyphot/plot/statplot.pyc in __call__(self, event)
52 if self.selected.has_key(artist):self.togglemarker(dot_artist)
53 else:
---> 54 self.togglemarker(dot_artist)
55
56 def togglemarker(self,artist,on_mark='o',off_mark='x'):
/Users/wkerzend/scripts/python/pyphot/plot/statplot.pyc in togglemarker(self, artist, on_mark, off_mark)
68 if type(self.selected)==list:self.selected[sel_index]=True
69 elif type(self.selected)==dict:self.selected[artist]=True
---> 70 self.axis.draw()
71
72 class keyhandler:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/axes.pyc in draw(self, renderer, inframe)
1535 # will draw the edges
1536 if self.axison and self._frameon:
-> 1537 self.patch.draw(renderer)
1538
1539 artists = []
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/patches.pyc in draw(self, renderer)
267 if not self.get_visible(): return
268 #renderer.open_group('patch')
--> 269 gc = renderer.new_gc()
270
271 if cbook.is_string_like(self._edgecolor) and self._edgecolor.lower()=='none':
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib-0.98.4-py2.5-macosx-10.3.egg/matplotlib/backends/backend_macosx.pyc in new_gc(self)
66
67 def new_gc(self):
---> 68 self.gc.reset()
69 return self.gc
70
RuntimeError: CGContextRef is NULL
-------------------------------------------------
I'm also using start_event_loop and stop event_loop to make the application blocking when starting and unblocking when finished. The application works its just annoying seeing this traceback everytime I select or deselect a point.
Another thing that sort of worked under linux was that when I clicked, it would change immediatley and not wait until I do a refit. Any ideas on what to do there?
Thanks
Wolfgang