python - Matplotlib Navigation Toolbar: remove "Edit curves lines and axes parameters" -
recently began exploring developing ui in qt designer , editing them through pyqt. things have been going pretty smoothy, i'm stuck trying solve following issue:
i've inserted matplotlib widget through qt designer , managed plot pretty horizontal bars using barh. next tried , managed insert functional navigationtoolbar through matplotlib.backends.backend_qt4agg.navigationtoolbar2qt
then, following thread (and similar ones) managed edit buttons display on toolbar... how modify navigation toolbar in matplotlib figure window?
it works every button except last one, check box drawing description "edit curves line , axes parameters". in particular case, remove button, because resizes plot when moving mouse , in case don't need button.
i haven't found yet thread discussing particular toolbar button (just 1 matplotlib: qt4agg toolbar's irritating bug)
the code used insert toolbar , edit buttons looks this:
from matplotlib.backends.backend_qt4agg import navigationtoolbar2qt class currentui(qtgui.qwidget): def __init__(self): super(currentui,self).__init__() (...) uic.loadui('portfoliomanager.ui',self) self.initui() (...) def initui(self): self.setwidgetspropertiesandactions() (...) def setwidgetspropertiesandactions(self): (...) self.navi_toolbar=navigationtoolbar(self.mplwidgetexposures, self) self.layoutplot.addwidget(self.navi_toolbar) (...) class navigationtoolbar(navigationtoolbar2qt): toolitems = [t t in navigationtoolbar2qt.toolitems if t[0] in ('home','pan', 'zoom', 'save','subplots')]
this embeds toolbar, "edit" button remains.
thanks insight. regards
you can remove adding following navigationtoolbar
class
actions = self.findchildren(qtgui.qaction) in actions: if a.text() == 'customize': self.removeaction(a) break
the reason can't remove particular button modifying toolitems
because gets added toolbar separately after toolitems
entries have been added.
text, tooltip_text, image_file, callback in self.toolitems: if text none: self.addseparator() else: = self.addaction(self._icon(image_file + '.png'), text, getattr(self, callback)) self._actions[callback] = if callback in ['zoom', 'pan']: a.setcheckable(true) if tooltip_text not none: a.settooltip(tooltip_text) if figureoptions not none: = self.addaction(self._icon("qt4_editor_options.png"), 'customize', self.edit_parameters) a.settooltip('edit curves line , axes parameters')
Comments
Post a Comment