python - matplotlib figure canvas name -
i have gui built using pyqt4 use matplotlib (figurecanvas) plot several plots using multiple canvases (this intentional rather using subplots). each canvas use method:
self.canvas_xx.mpl_connect('scroll_event', self.on_mouse_scroll)
where xx represents iteration of canvas signal perform action. want able reference canvas name rather using:
ylabel = event.inaxes.axes.get_ylabel().split(' ')[0]
where use longer method of referncing ylabel name of each graph.
i looked under event method using: dir(event) , there method called "canvas", there no apparent method name of canvas.
any ideas?
i not quite sure mean name, can a reference canvas
object via
event_canvas = event.inaxes.axes.figure.canvas
and canvas events hashable, can use them keys in dict
other_thing = pre_populated_dict[event_canvas]
to keep track of ever other data want given canvas in code.
in python there is, in general, not clean way names of references object (it can done, shouldn't).
Comments
Post a Comment