本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg.setMovable方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QTAgg.setMovable方法的具体用法?Python NavigationToolbar2QTAgg.setMovable怎么用?Python NavigationToolbar2QTAgg.setMovable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg
的用法示例。
在下文中一共展示了NavigationToolbar2QTAgg.setMovable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plotwidget
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import setMovable [as 别名]
class plotwidget(FigureCanvas):
def __init__(self, parent, width=12, height=6, dpi=72, projection3d=False):
#plotdata can be 2d array for image plot or list of 2 1d arrays for x-y plot or 2d array for image plot or list of lists of 2 1D arrays
self.fig=Figure(figsize=(width, height), dpi=dpi)
if projection3d:
self.axes=self.fig.add_subplot(111, navigate=True, projection='3d')
else:
self.axes=self.fig.add_subplot(111, navigate=True)
self.axes.hold(True)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
#self.parent=parent
FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding, QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
#NavigationToolbar(self, parent)
self.toolbar=NavigationToolbar(self.figure.canvas, self)
self.toolbar.setMovable(True)#DOESNT DO ANYTHING
self.mpl_connect('button_press_event', self.myclick)
self.clicklist=[]
def myclick(self, event):
if not (event.xdata is None or event.ydata is None):
arrayxy=[event.xdata, event.ydata]
print 'clicked on image: array indeces ', arrayxy, ' using button', event.button
self.clicklist+=[arrayxy]
self.emit(SIGNAL("genericclickonplot"), [event.xdata, event.ydata, event.button])
示例2: ApplicationWindow
# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import setMovable [as 别名]
#.........这里部分代码省略.........
dock = QtGui.QDockWidget("Log", self)
self.Log = QtGui.QTextEdit(dock)
dock.setWidget(self.Log)
self.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.Log.setReadOnly(True)
dock = QtGui.QDockWidget("Fit Log", self)
self.fitLog = QtGui.QTextEdit(dock)
dock.setWidget(self.fitLog)
self.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.fitLog.setReadOnly(True)
def createImageDock(self):
dock = QtGui.QDockWidget("Image & Preview", self)
self.imageWidget=QtGui.QMainWindow()
self.imageWidget.setParent(dock)
dock.setWidget(self.imageWidget)
self.addDockWidget(QtCore.Qt.RightDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.canvas = MPLCanvas(dock)
self.mpl_toolbar = NavigationToolbar(self.canvas, self.imageWidget,coordinates=False)
actlist= self.mpl_toolbar.actions()
names=["Save","Customize","Subplots"]
for action in actlist:
if str(action.text()) in names:
self.mpl_toolbar.removeAction(action)
self.previewCheck=QtGui.QCheckBox("Preview")
self.previewCheck.stateChanged.connect(self.previewCheckBoxChanged)
self.mpl_toolbar.addWidget(self.previewCheck)
self.mpl_toolbar.setMovable(False)
self.imageWidget.addToolBar(self.mpl_toolbar)
self.imageWidget.setCentralWidget(self.canvas)
self.imageWidget.setMinimumSize(600,450)
def createWireOptions(self):
dock = QtGui.QDockWidget("Wire Options", self)
dock.setMaximumWidth(340)
dock.setMinimumWidth(280)
widget=QtGui.QWidget()
dock.setWidget(widget)
self.wireOptionsLayout=QtGui.QGridLayout()
widget.setLayout(self.wireOptionsLayout)
self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock)
self.viewMenu.addAction(dock.toggleViewAction())
self.modeCombo=QtGui.QComboBox()
self.wireOptionsLayout.addWidget(self.modeCombo,0,0)
self.modeCombo.insertItem(0,"manual")
self.modeCombo.insertItem(0,"select")
self.modeCombo.insertItem(0,"auto")
self.modeCombo.setEnabled(False)
self.wireCombo=QtGui.QComboBox()
self.wireOptionsLayout.addWidget(self.wireCombo,0,1)
self.wireCombo.setEnabled(False)
self.wireCombo.activated.connect(self.wireChanged)
self.modeCombo.activated.connect(self.modeChanged)
def createContactOptions(self):
dock = QtGui.QDockWidget("Contact Settings", self)
dock.setMaximumWidth(340)
dock.setMinimumWidth(280)
widget=QtGui.QWidget()
dock.setWidget(widget)