当前位置: 首页>>代码示例>>Python>>正文


Python NavigationToolbar2QTAgg.addWidget方法代码示例

本文整理汇总了Python中matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg.addWidget方法的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QTAgg.addWidget方法的具体用法?Python NavigationToolbar2QTAgg.addWidget怎么用?Python NavigationToolbar2QTAgg.addWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg的用法示例。


在下文中一共展示了NavigationToolbar2QTAgg.addWidget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ApplicationWindow

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import addWidget [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()
开发者ID:drueffer,项目名称:apage_rom,代码行数:70,代码来源:GUIContact.py

示例2: CalibrationWindow

# 需要导入模块: from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg import addWidget [as 别名]
class CalibrationWindow(QtGui.QMainWindow):
    """
    Order on the layers in the right tab

    mask > data > massif > solid_angle
    """
    ZORDER = {"contour":5,
              "point": 4,
              "mask": 3,
              "data": 2,
              "massif": 1,
              "solidangle": 0,
              }
    INTERPOLATION = "nearest"
    ORIGIN = "lower"

    def __init__(self,):
        QtGui.QWidget.__init__(self)
        uic.loadUi("calibration_main.ui", self)
        self.connect(self.actionAbout_calibrate, SIGNAL("triggered()"), self.on_about)
        self.dpi = 100
        self.fig = self.canvas = self.mpl_toolbar = self.pix_coords_label = None
        self.axes = None
        # ar is for artists: plot, images or labels...
        self.ar_data = self.ar_mask = self.ar_massif = self.ar_contour = self.ar_solidangle = self.ar_points = None
        self.data = self.massif = self.solid_angle = self.mask = None
        self.display_checks = {}
        self.display_widget = None
        self.input_widget = None
        self.build_right_frame()
        self.build_input_tab()

    def on_about(self):
        msg = [__doc__,
               "",
               "Version date: \t%s" % __date__,
               "PyFAI version: \t%s" % pyFAI.version,
               "FabIO version: \t%s" % fabio.version,
               "Author: \t\t%s" % __author__,
               "Copyright: \t\t%s" % __copyright__,
               "License: \t\t%s" % __license__]
        QtGui.QMessageBox.about(self, "About calibrate", os.linesep.join(msg))

    def build_right_frame(self):
        "build the right frame that contains matplotlib widgets"

        self.fig = Figure(dpi=self.dpi)
        self.canvas = FigureCanvas(self.fig)
        self.canvas.setParent(self.image_frame)

        # Create the navigation toolbar, tied to the canvas
        self.mpl_toolbar = NavigationToolbar(self.canvas, self.image_frame, coordinates=False)

        self.axes = self.fig.add_subplot(111)
        self.axes.set_visible(False)
        # Bind the 'pick' event for clicking on one of the bars
        self.canvas.mpl_connect('motion_notify_event', self.on_pick)

        self.pix_coords_label = QtGui.QLabel("x= None , y= None , i= None ", self)
        self.mpl_toolbar.addWidget(self.pix_coords_label)

        self.display_widget = uic.loadUi("display_widget.ui")

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.mpl_toolbar, alignment=QtCore.Qt.AlignTop)
        vbox.addWidget(self.canvas)
        vbox.addWidget(self.display_widget, alignment=QtCore.Qt.AlignBottom)
        self.image_frame.setLayout(vbox)

        # Enforce the size Policy of sub-widgets
        pol = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
        self.mpl_toolbar.setSizePolicy(pol)
        self.display_widget.setSizePolicy(pol)
        self.canvas.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))

        # few signals about those new widgets:
        self.display_checks = {"data": self.display_widget.show_data,
                               "mask": self.display_widget.show_mask,
                               "massif": self.display_widget.show_massif,
                               "points": self.display_widget.show_points,
                               "contour": self.display_widget.show_contour,
                               "solidangle": self.display_widget.show_solidangle}
        for v in self.display_checks.itervalues():
            self.connect(v, SIGNAL("stateChanged(int)"), self.toggle_show)

    def build_input_tab(self):
        self.input_widget = InputWidget()
        self.scrollArea_input.setWidget(self.input_widget)

#        area->setWidget(widget);
#        box = QtGui.QHBoxLayout()
#        box.addWidget(self.input_widget)
#        self.input_frame.setLayout(box)
#        self.input_widget.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
#        self.input_frame.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))


    def on_pick(self, event):
        if event.inaxes and self.data is not None and self.data.any():
            if int(event.xdata) <= self.data.shape[1] and int(event.ydata) <= self.data.shape[0]:
#.........这里部分代码省略.........
开发者ID:kif,项目名称:UPBL09a,代码行数:103,代码来源:calibration_view.py


注:本文中的matplotlib.backends.backend_qt4agg.NavigationToolbar2QTAgg.addWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。