SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: John H. <jd...@gm...> - 2007年03月26日 15:10:23
Those of you who updated from mpl svn between last night and now, may
have noticed that the pan/zoom/etc functionality was broken. Last
night I factored out the callback event handler that we use to support
the toolbar navigation into a reusable class in cbook. And I broke
it.
It is now fixed in revision 3126. If you want to use something like
this in your own code, it goes like so
In [1]: from matplotlib.cbook import CallbackRegistry
In [2]: signals = 'eat', 'drink', 'be merry'
In [3]: def oneat(x): print 'eat', x
In [5]: def ondrink(x): print 'drink', x
In [6]: callbacks = CallbackRegistry(signals)
In [7]: cid = callbacks.connect('eat', oneat)
In [8]: cid2 = callbacks.connect('drink', ondrink)
In [11]: callbacks.process('drink', 123)
drink 123
In [12]: callbacks.process('eat', 456)
eat 456
In [13]: callbacks.process('be merry', 456)
In [14]: callbacks.disconnect(cid)
In [15]: callbacks.process('eat', 456)
In [16]: tmp = callbacks.connect('drunk', ondrink)
------------------------------------------------------------
Traceback (most recent call last):
 File "<ipython console>", line 1, in ?
 File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/cbook.py",
line 39, in connect
 self._check_signal(s)
 File "/home/titan/johnh/dev/lib/python2.4/site-packages/matplotlib/cbook.py",
line 32, in _check_signal
 raise ValueError('Unknown signal "%s"; valid signals are %s'%(s, signals))
ValueError: Unknown signal "drunk"; valid signals are ['be merry',
'drink', 'eat']
JDH
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /