• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python backend_qt4.NavigationToolbar2QT类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中matplotlib.backends.backend_qt4.NavigationToolbar2QT的典型用法代码示例。如果您正苦于以下问题:Python NavigationToolbar2QT类的具体用法?Python NavigationToolbar2QT怎么用?Python NavigationToolbar2QT使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __init__

    def __init__(self, canvas, frame, name=None):
        """ Create a new toolbar object

        Parameters
        ----------
        data_collection : DataCollection instance
         The data collection that this toolbar is meant to edit.
         The toolbar looks to this collection for the available subsets
         to manipulate.
        canvas : Maptloblib canvas instance
         The drawing canvas to interact with
        frame : QWidget
         The QT frame that the canvas is embedded within.
        """
        self.buttons = {}
        self.__active = None
        self.basedir = None
        NavigationToolbar2QT.__init__(self, canvas, frame)
        if name is not None:
            self.setWindowTitle(name)
        self.setIconSize(QtCore.QSize(25, 25))
        self.layout().setSpacing(1)
        self.setFocusPolicy(Qt.StrongFocus)
        self._idKey = None

        # pyside is prone to segfaults if slots hold the only
        # reference to a signal, so we hold an extra reference
        # see https://bugreports.qt-project.org/browse/PYSIDE-88
        self.__signals = []
开发者ID:Spencerx,项目名称:glue,代码行数:29,代码来源:glue_toolbar.py


示例2: _init_toolbar

 def _init_toolbar(self):
     NavigationToolbar2QT._init_toolbar(self) 
    
     # adding a new icon
     icon=QtGui.QIcon()
     icon.addPixmap(QtGui.QPixmap(":/MPL Toolbar/export_ascii.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
     a=self.addAction(icon, "Export", self.export_ascii)
     a.setToolTip('Export the plot into ASCII file')
开发者ID:neutrons,项目名称:GUI_Tools,代码行数:8,代码来源:mplwidget.py


示例3: __init__

    def __init__(self, canvas, parent, coordinates=True):
        """
        Constructor of NavToolBar

        :param canvas: the matplotlib canvas
        :type canvas: matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg
        :param parent: the parent QWidget
        :type parent: PyQt4.QtGui.QWidget
        :param coordinates: boolean coordinates
        :type coordinates: bool
        """
        NavigationToolbar2QT.__init__(self, canvas, parent, coordinates)
        self.setIconSize(QSize(16, 16))
开发者ID:MiRichter,项目名称:OptiSim,代码行数:13,代码来源:navtoolbar.py


示例4: __init__

    def __init__(self, canvas, frame, name=None):
        """ Create a new toolbar object

        Parameters
        ----------
        data_collection : DataCollection instance
         The data collection that this toolbar is meant to edit.
         The toolbar looks to this collection for the available subsets
         to manipulate.
        canvas : Maptloblib canvas instance
         The drawing canvas to interact with
        frame : QWidget
         The QT frame that the canvas is embedded within.
        """
        self.buttons = {}
        self.basedir = None
        NavigationToolbar2QT.__init__(self, canvas, frame)
        if name is not None:
            self.setWindowTitle(name)
        self.setIconSize(QtCore.QSize(25, 25))
        self.layout().setSpacing(1)
        self.setFocusPolicy(Qt.StrongFocus)
开发者ID:drphilmarshall,项目名称:glue,代码行数:22,代码来源:glue_toolbar.py


示例5: __init__

 def __init__(self, canvas, parent, coordinates=False):
     NavigationToolbar2QT.__init__(self, canvas, parent, coordinates)
     self.setIconSize(QtCore.QSize(20, 20)) # to change size of icons in toolbar
开发者ID:neutrons,项目名称:GUI_Tools,代码行数:3,代码来源:mplwidget.py


示例6: __init__

        def __init__(self):
            Qt.QMainWindow.__init__(self, None)
            #                            "application main window",
            #                            Qt.WType_TopLevel | Qt.WDestructiveClose)

            self.file_menu = Qt.QMenu("&File", self)
            self.file_menu.addAction("&Quit", self.fileQuit, Qt.Qt.CTRL + Qt.Qt.Key_Q)
            self.menuBar().addMenu(self.file_menu)

            self.help_menu = Qt.QMenu("&Help", self)
            self.menuBar().addSeparator()
            self.menuBar().addMenu(self.help_menu)

            self.help_menu.addAction("&About", self.about)

            self.main_widget = Qt.QWidget(self)

            l = Qt.QVBoxLayout(self.main_widget)
            sc = MyPylabPlotter(self.main_widget, dpi=100)
            toolbar = NavigationToolbar(sc, self.main_widget)
            toolbar.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed)
            l.addWidget(sc)
            l.addWidget(toolbar)

            self.main_widget.setFocus()
            self.setCentralWidget(self.main_widget)

            # Produce a plot that is contained in MyPylabPlotter
            sc.demo_pythonic_matplotlib()
            # Produce a plot that is separate from MyPylabPlotter
            sc.demo_pylab_figure()
开发者ID:ska-sa,项目名称:meqtrees-timba,代码行数:31,代码来源:pylab_plotter.py


示例7: MPL_Widget

class MPL_Widget(QtGui.QWidget):
    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)
        self.canvas = MyMplCanvas()
        #self.toolbar = MyNavigationToolbar(self.canvas, self.canvas, direction = 'v')
        self.toolbar = NavigationToolbar(self.canvas, self.canvas)
        #self.toolbar.hide()
        self.hbox = QtGui.QHBoxLayout()
        #self.hbox.addWidget(self.toolbar)
        self.hbox.addWidget(self.canvas)
        self.setLayout(self.hbox)
        ##########################
        self.hZoom = QtGui.QAction("Zoom",  self)
        self.hZoom.setShortcut("Ctrl+Z")
        self.addAction(self.hZoom)
        QtCore.QObject.connect(self.hZoom,QtCore.SIGNAL("triggered()"), self.ZoomToggle)

        self.actionAutoScale = QtGui.QAction("AutoScale",  self)#self.MainWindow)
        self.actionAutoScale.setShortcut("Ctrl+A")
        self.addAction(self.actionAutoScale)
        QtCore.QObject.connect(self.actionAutoScale,QtCore.SIGNAL("triggered()"), self.autoscale_plot)

    def ZoomToggle(self):
        self.toolbar.zoom()

    def autoscale_plot(self):
        self.toolbar.home()
开发者ID:pombredanne,项目名称:toolz-1,代码行数:27,代码来源:mpl3D_custom_widget.py


示例8: __init__

    def __init__(self , canvas , parent , direction = 'h' ) :
        #NavigationToolbar.__init__(self,parent,canvas)
        #self.layout = QVBoxLayout( self )
        self.canvas = canvas
        QtGui.QWidget.__init__( self, parent )

        if direction=='h' :    self.layout = QtGui.QHBoxLayout( self )
        else : self.layout = QtGui.QVBoxLayout( self )
        self.layout.setMargin( 2 )
        self.layout.setSpacing( 0 )
        NavigationToolbar.__init__( self, canvas, parent ) 
开发者ID:limu007,项目名称:Charlay,代码行数:11,代码来源:canvas.py


示例9: __init__

    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)
        self.canvas = MyMplCanvas()
        #self.toolbar = MyNavigationToolbar(self.canvas, self.canvas, direction = 'v')
        self.toolbar = NavigationToolbar(self.canvas, self.canvas)
        self.toolbar.hide()
        self.hbox = QtGui.QHBoxLayout()
        #self.hbox.addWidget(self.toolbar)
        self.hbox.addWidget(self.canvas)
        self.setLayout(self.hbox)
        ##########################
        self.hZoom = QtGui.QAction("Zoom",  self)
        self.hZoom.setShortcut("Ctrl+Z")
        self.addAction(self.hZoom)
        QtCore.QObject.connect(self.hZoom,QtCore.SIGNAL("triggered()"), self.ZoomToggle)

        self.actionAutoScale = QtGui.QAction("AutoScale",  self)#self.MainWindow)
        self.actionAutoScale.setShortcut("Ctrl+A")
        self.addAction(self.actionAutoScale)
        QtCore.QObject.connect(self.actionAutoScale,QtCore.SIGNAL("triggered()"), self.autoscale_plot)


        self.installEventFilter(EventFilter(self))

        ###########SAVING FIGURE TO CLIPBOARD##########
        self.cb = None #will be used for the clipboard
        self.tempPath = getHomeDir()
        self.tempPath = os.path.join(self.tempPath,'tempMPL.png')
开发者ID:pombredanne,项目名称:toolz-1,代码行数:28,代码来源:mplElemIso.py


示例10: show_pylab_plot

    def show_pylab_plot(self, store_rec=True):
        """ process incoming data and attributes into the
        appropriate type of plot """

        # if we are single stepping through requests, Oleg may reset the
        # cache, so check for a non-data record situation
        if store_rec and isinstance(self._rec, bool):
            return

        pylab_record = self._rec.plotdefs
        if not self._pylab_plotter is None:
            #     self._pylab_plotter.reparent(Qt.QWidget(), 0, Qt.QPoint())
            self._pylab_plotter.setParent(Qt.QWidget())
            self._pylab_plotter = None
        if not self._toolbar is None:
            #     self._toolbar.reparent(Qt.QWidget(), 0, Qt.QPoint())
            self._toolbar.setParent(Qt.QWidget())
            self._toolbar = None
        if self._pylab_plotter is None:
            self._pylab_plotter = MyPylabPlotter(parent=self.layout_parent)
            self.layout.addWidget(self._pylab_plotter, 1, 0)
            self._pylab_plotter.show()
        if self._toolbar is None:
            self._toolbar = NavigationToolbar(self._pylab_plotter, self.layout_parent)
            self._toolbar.setSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Fixed)
            self.layout.addWidget(self._toolbar, 0, 0)
            self._toolbar.show()
        self._pylab_plotter.make_plot(pylab_record)
开发者ID:ska-sa,项目名称:meqtrees-timba,代码行数:28,代码来源:pylab_plotter.py


示例11: __init__

    def __init__(self, parent=None):
        # initialization of the superclass
        super(ArchaeoPYMainWindow, self).__init__(parent)
        # setup the GUI --> function generated by pyuic4
        self.setupUi(self)
        # Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
        self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
        self.navi_toolbar.clear()

        # Adds Buttons
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("home.png"), "Home", self.navi_toolbar.home)
        # a.setToolTip('returns axes to original position')
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("move.png"), "Pan", self.navi_toolbar.pan)
        a.setToolTip("Pan axes with left mouse, zoom with right")
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("zoom_to_rect.png"), "Zoom", self.navi_toolbar.zoom)
        a.setToolTip("Zoom to Rectangle")
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("filesave.png"), "Save", self.navi_toolbar.save_figure)
        a.setToolTip("Save the figure")

        QtGui.QShortcut(QtGui.QKeySequence("Ctrl+C"), self, self.copy_to_clipboard)

        # self.xlabel = QtGui.QInputDialog.getText(self, 'X-axis Label')

        # Button_layout is a QT desginer Grid Layout.
        self.toolbar_grid.addWidget(self.navi_toolbar)
        self.button_grid()
开发者ID:Calorian,项目名称:ArchaeoPY,代码行数:26,代码来源:plotter_gui.py


示例12: __init__

     def __init__(self, parent = None):
         # initialization of the superclass
         super(ArchaeoPYMainWindow, self).__init__(parent)
         # setup the GUI --> function generated by pyuic4
         self.setupUi(self)
         #Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
         self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
         self.navi_toolbar.clear()
 
     #Adds Buttons
         a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
                                         self.navi_toolbar.home)
         #a.setToolTip('returns axes to original position')
         a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
                                         self.navi_toolbar.pan)
         a.setToolTip('Pan axes with left mouse, zoom with right')
         a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
                                         self.navi_toolbar.zoom)
         a.setToolTip('Zoom to Rectangle')
         a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
                            self.navi_toolbar.save_figure)
         a.setToolTip('Save the figure')
 
         #Button_layout is a QT desginer Grid Layout.
         self.toolbar_grid.addWidget(self.navi_toolbar)
         self.Button_Definitions()
         self.plot_options()
开发者ID:ArchaeoPY,项目名称:ArchaeoPY,代码行数:27,代码来源:view_and_save_data_gui.py


示例13: PlotWidget

class PlotWidget(QtGui.QWidget):
    """This class represents the plot view for plotting graphs.

    :returns: an instance of *PlotWidget*
    """

    def __init__(self,):
        QtGui.QWidget.__init__(self)
        self.figure = Figure(facecolor=(1, 1, 1), tight_layout=True)

        self.ax = self.figure.add_subplot(111)

        # Canvas
        self.canvas = FigureCanvas(self.figure)
        self.canvas.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                  QtGui.QSizePolicy.Expanding)
        self.canvas.updateGeometry()

        # Navigation
        self.navi_toolbar = NavigationToolbar(self.canvas, self)
        self.navi_toolbar.setOrientation(QtCore.Qt.Vertical)
        # Fixed with, otherwise navigation bar resize arbitrary
        self.navi_toolbar.setFixedWidth(40)

        self.vbl = QtGui.QHBoxLayout()
        self.vbl.addWidget(self.navi_toolbar)
        self.vbl.addWidget(self.canvas)
        self.setLayout(self.vbl)

    def plot(self, x_data_1, y_data_1, x_data_2, y_data_2):
        """Plot given data on *PlotWidget*.

        :param x_data_1: X-axis data for plot 1
        :type x_data_1: array_like
        :param y_data_1: Y-axis data for plot 1
        :type y_data_1: array_like
        :param x_data_2: X-axis data for plot 2
        :type x_data_2: array_like
        :param y_data_2: Y-axis data for plot 2
        :type y_data_2: array_like
        """
        self.ax.clear()
        self.ax.grid(True)
        self.ax.plot(x_data_1, y_data_1, 'b^', label='Input Data')
        self.ax.plot(x_data_2, y_data_2, 'b-', label='Fitted Data')
        self.ax.legend()
        self.canvas.draw()
开发者ID:ckaus,项目名称:EpiPy,代码行数:47,代码来源:plotwidget.py


示例14: MatplotlibWidget

class MatplotlibWidget(QtGui.QWidget):

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.frame = QWidget()
        self.canvas = MplCanvas()
        self.canvas.setParent(self.frame)
        self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame)
        self.vbl = QtGui.QVBoxLayout()
        self.vbl.addWidget(self.canvas)
        self.vbl.addWidget(self.mpltoolbar)
        self.setLayout(self.vbl)

        self.mpltoolbar.toggleViewAction()

    def setTitle(self, text):
        """
        Sets the figure title
        """
        self.canvas.setTitle(text)

    def get_axis(self):
        return self.canvas.ax

    def get_figure(self):
        return self.canvas.fig

    def clear(self, force=False):
        if force:
            self.canvas.fig.clear()
            self.canvas.ax = self.canvas.fig.add_subplot(111)
            # self.canvas.ax.clear()
            # self.canvas = MplCanvas()
        else:
            self.canvas.ax.clear()

    def redraw(self):
        self.canvas.ax.figure.canvas.draw()

    def plot(self, x, y, title='', xlabel='', ylabel=''):
        self.setTitle(title)
        self.canvas.ax.plot(x, y)

        self.redraw()
开发者ID:SanPen,项目名称:GridCal,代码行数:45,代码来源:matplotlibwidget.py


示例15: init_plots

    def init_plots(self):
        """ Initialize plots used in plugin """
        self.plot_dock = QtGui.QDockWidget('TSTools Plots',
                                           self.iface.mainWindow())
        self.plot_dock.setObjectName('TSTools Plots')

        settings.plot_dirty = []
        for plot in plots.plots:
            self.plots.append(plot(self.iface))
            settings.plot_dirty.append(False)

        self.plot_tabs = QtGui.QTabWidget(self.plot_dock)

        @QtCore.pyqtSlot(int)
        def tab_changed(idx):
            """ Updates current tab index & re-plots if needed """
            settings.plot_current = idx
            if settings.plot_dirty[idx]:
                self.plots[idx].plot()
                settings.plot_dirty[idx] = False
        self.plot_tabs.currentChanged.connect(tab_changed)

        for plot in self.plots:
            widget = QtGui.QWidget()
            layout = QtGui.QHBoxLayout()
            nav = NavigationToolbar(plot, widget, coordinates=False)
            nav.setOrientation(QtCore.Qt.Vertical)

            nav.setSizePolicy(QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed)
            plot.setSizePolicy(QtGui.QSizePolicy.Preferred,
                               QtGui.QSizePolicy.Preferred)

            layout.addWidget(nav)
            layout.addWidget(plot)

            widget.setLayout(layout)
            self.plot_tabs.addTab(widget, plot.__str__())

        self.plot_dock.setWidget(self.plot_tabs)
        self.iface.addDockWidget(QtCore.Qt.BottomDockWidgetArea,
                                 self.plot_dock)
开发者ID:ceholden,项目名称:TSTools,代码行数:42,代码来源:tstools.py


示例16: __init__

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.frame = QWidget()
        self.canvas = MplCanvas()
        self.canvas.setParent(self.frame)
        self.mpltoolbar = Navigationtoolbar(self.canvas, self.frame)
        self.vbl = QtGui.QVBoxLayout()
        self.vbl.addWidget(self.canvas)
        self.vbl.addWidget(self.mpltoolbar)
        self.setLayout(self.vbl)

        self.mpltoolbar.toggleViewAction()
开发者ID:SanPen,项目名称:GridCal,代码行数:13,代码来源:matplotlibwidget.py


示例17: __init__

    def __init__(self, parent = None, enableAutoScale = True, enableCSV = False, enableEdit = True, doublePlot = False, layoutDir = 'h'):
        QtGui.QWidget.__init__(self, parent)
        if doublePlot:
            self.canvas = DoubleMyMplCanvas()
        else:
            self.canvas = MyMplCanvas()
        self.toolbar = NavigationToolbar(self.canvas, self.canvas)
#        self.toolbar.hide()
        self.installEventFilter(EventFilter(self))

        if layoutDir == 'v':
            self.toolbar.setOrientation(QtCore.Qt.Vertical)
            self.layout = QtGui.QHBoxLayout()


        elif layoutDir == 'h':
            self.layout = QtGui.QVBoxLayout()
#            self.layout.addWidget(self.canvas)
#            self.layout.addWidget(self.toolbar)
        self.layout.addWidget(self.toolbar)
        self.layout.addWidget(self.canvas)
        self.setLayout(self.layout)

        ##########################

        self.dataLabels = None

        ###########SAVING FIGURE TO CLIPBOARD##########
        self.cb = None #will be used for the clipboard
        self.tempPath = getHomeDir()
        self.tempPath = os.path.join(self.tempPath,'tempMPL.png')

        if enableEdit:
            self.enableEdit()

        self.lineDict = None
        self.addLegend = False


        self.x = None#used for picker
        self.y = None

        #######SAVING FIGURE DATA############################
        if enableCSV:
            self.enableCSV()


        ########### HELPER FUNCTIONS #########################
        self.clearPlotAction = QtGui.QAction("Clear Plot", self)
        self.addAction(self.clearPlotAction)
        QtCore.QObject.connect(self, QtCore.SIGNAL("triggered()"), self.clearPlot)
开发者ID:pombredanne,项目名称:toolz-1,代码行数:51,代码来源:mpl_custom_widget.py


示例18: Plot_Function

    def Plot_Function(self):

        """
            Clears Matplotlib Widget Canvas
            
            Adds 3 subplots
            
            plots Difference Data
            
            sharex - shares x axis between subplots
            """
        # self.legend.remove()

        # Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
        self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
        self.navi_toolbar.clear()

        # Adds Buttons
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("home.png"), "Home", self.navi_toolbar.home)
        # a.setToolTip('returns axes to original position')
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("move.png"), "Pan", self.navi_toolbar.pan)
        a.setToolTip("Pan axes with left mouse, zoom with right")
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("zoom_to_rect.png"), "Zoom", self.navi_toolbar.zoom)
        a.setToolTip("Zoom to Rectangle")
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon("filesave.png"), "Save", self.navi_toolbar.save_figure)
        a.setToolTip("Save the figure")

        self.toolbar_grid.addWidget(self.navi_toolbar)

        self.top_xval = self.top_data[self.top_data.dtype.names[self.top_xcombo.currentIndex()]]
        self.top_yval = self.top_data[self.top_data.dtype.names[self.top_ycombo.currentIndex()]]
        self.yval = self.yval - np.median(self.yval)

        x1 = np.linspace(0.0, 5.0)
        y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
        y2 = np.cos(3 * np.pi * x1) * np.exp(-x1)
        y3 = np.cos(4 * np.pi * x1) * np.exp(-x1)
        self.mpl.canvas.fig.clear()

        self.plot1 = self.mpl.canvas.fig.add_subplot(3, 1, 1)
        # self.plot1.plot(self.top_xval,self.top_yval)

        self.plot2 = self.mpl.canvas.fig.add_subplot(3, 1, 2, sharex=self.plot1)
        self.plot2.plot(x1, y2)

        self.plot3 = self.mpl.canvas.fig.add_subplot(3, 1, 3, sharex=self.plot1)
        self.plot3.plot(x1, y3)
开发者ID:Calorian,项目名称:ArchaeoPY,代码行数:47,代码来源:multiple_subplots_gui.py


示例19: __init__

    def __init__(self, parent = None):
        # initialization of the superclass
        super(ModellerMainWindow, self).__init__(parent)
        # setup the GUI --> function generated by pyuic4
        self.setupUi(self)
        #Adds a Matplotlib Toolbar to the display, clears the display and adds only the required buttons
        self.navi_toolbar = NavigationToolbar(self.mpl.canvas, self)
        #self.navi_toolbar.clear()
        
 # Add the x,y location widget at the right side of the toolbar
 # The stretch factor is 1 which means any resizing of the toolbar
 # will resize this label instead of the buttons.
#        self.navi_toolbar.locLabel = QtGui.QLabel( "", self )
#        self.navi_toolbar.locLabel.setAlignment(QtCore.Qt.AlignLeft)
#        self.navi_toolbar.locLabel.setSizePolicy(
#        QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
#                           QtGui.QSizePolicy.Expanding))
#        labelAction = self.navi_toolbar.addWidget(self.navi_toolbar.locLabel)
#        labelAction.setVisible(True)
#Adds Buttons
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon('home.png'), 'Home',
                                        self.navi_toolbar.home)
        #a.setToolTip('returns axes to original position')
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon('move.png'), 'Pan',
                                        self.navi_toolbar.pan)
        a.setToolTip('Pan axes with left mouse, zoom with right')
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon('zoom_to_rect.png'), 'Zoom',
                                        self.navi_toolbar.zoom)
        a.setToolTip('Zoom to Rectangle')
        a = self.navi_toolbar.addAction(self.navi_toolbar._icon('filesave.png'), 'Save',
                           self.navi_toolbar.save_figure)
        a.setToolTip('Save the figure')

        #Button_layout is a QT desginer Grid Layout.
        self.toolbar_grid.addWidget(self.navi_toolbar)
        self.Button_Definitions()
        
        #Run Radio Toggle Code to grey / allow relevant options
        self.radioButton_2d.click()
        self.radioButton_res.click()
        self.MagRes2D3Dtoggle()
开发者ID:GDArkley,项目名称:ArchaeoPY-Modeller,代码行数:41,代码来源:main.py


示例20: __init__

      def __init__(self, parent = None):
           # initialization of Qt MainWindow widget
           QtGui.QWidget.__init__(self, parent)

           # set the canvas to the Matplotlib widget
           self.canvas = Rt60Canvas()

           # create a vertical box layout
           self.vbl = QtGui.QVBoxLayout()

           # add rt60 widget to vertical box
           self.vbl.addWidget(self.canvas)

           # add interactive navigation
           self.navi_toolbar = NavigationToolbar(self.canvas, self)
           self.vbl.addWidget(self.navi_toolbar)

           # bind events related to drawing lines
           self.canvas.mpl_connect('button_press_event', self.on_press)
           self.canvas.mpl_connect('button_release_event', self.on_release)
           self.canvas.mpl_connect('motion_notify_event', self.on_motion)

           # set the layout to th vertical box
           self.setLayout(self.vbl)

           # no buttons pressed
           self.press = None


           # the line that users get to draw
           self.linex = [0]
           self.liney = [0]
           self.line, = self.canvas.ax.plot(self.linex, self.liney)
           self.line.set_color("red")
           self.line.set_linewidth(1.5)
           self.line.set_linestyle('-')
           
           # initialize annotation
           self.status_text = self.canvas.ax.text(0.45, 0.9, '', transform=self.canvas.ax.transAxes,size=14,ha='center')
开发者ID:drscotthawley,项目名称:SHAART,代码行数:39,代码来源:rt60widget.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python backend_qt4agg.FigureCanvasQTAgg类代码示例发布时间:2022-05-27
下一篇:
Python backend_pdf.PdfPages类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap