wie kann man einzelne buttons einer navigationstoolbox, welches mit einem mpl widget angezeigt wird, löschen?
ist das überhaupt möglich?
Mein Code:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
# Numpy functions for image creation
import numpy as np
# Matplotlib Figure object
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
Code: Alles auswählen
class Form_TshTDlg(QDialog):
def __init__(self, T_SI_opt, s_SI_opt,h_SI_opt, ORC_data_opt, Heatsource_opt, Heatsink_opt, parent = None):
super(Form_TshTDlg, self).__init__(parent)
# set window title
self.setWindowTitle("T-s and h-T Diagram")
# instantiate a widget, it will be the main one
self.main_widget = QWidget(self)
# create a push Button
self.okButton = QPushButton("OK",self)
# create a vertical box layout widget
vbl = QVBoxLayout(self.main_widget)
# instantiate our Matplotlib canvas widget
qmc = Qt4MplCanvas_TshTDlg(T_SI_opt, s_SI_opt,h_SI_opt, ORC_data_opt, Heatsource_opt, Heatsink_opt, self.main_widget) #kopplung widget und erzeugtes figure in anderer klasse
# instantiate the navigation toolbar
ntb = NavigationToolbar(qmc, self.main_widget)
# pack these widget into the vertical box
vbl.addWidget(qmc)
vbl.addWidget(ntb)
vbl.addWidget(self.okButton)
self.setLayout(vbl)
self.main_widget.setFocus()
self.connect(self.okButton, SIGNAL("clicked()"), self.accept)
class Qt4MplCanvas_TshTDlg(FigureCanvas):
"""Class to represent the FigureCanvas widget"""
def __init__(self, T_SI_opt, s_SI_opt, h_SI_opt, ORC_data_opt, Heatsource_opt, Heatsink_opt, parent):
#plot definition
self.fig = Figure()
...
# initialization of the canvas
FigureCanvas.__init__(self, self.fig)
# set the parent widget
self.fig.subplots_adjust(hspace=0.4)
self.setParent(parent)
# we define the widget as expandable
FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding,QSizePolicy.Expanding)
# notify the system of updated policy
FigureCanvas.updateGeometry(self)