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


Python FigureCanvasQTAgg.setObjectName方法代码示例

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


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

示例1: gerar_widgets

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setObjectName [as 别名]
 def gerar_widgets(self):
     '''
     Gera todos os widgets dos gráficos que serão colocados nas telas
     '''
     for indice in range(len(self.matrizes)):
         graph_widget = Grafics_widget()
         graph_widget.setup()
         
         widget_delaunay = FigureWidget(self.figuras_triang[indice])
         widget_delaunay.setObjectName(_fromUtf8("widget_delaunay"))
         widget_delaunay.setParent(graph_widget.groupBox_2)
         graph_widget.gridLayout_4.addWidget(widget_delaunay, 0, 0, 1, 1)
         
         widget_vector = FigureWidget(self.figuras_vet[indice])
         widget_vector.setObjectName(_fromUtf8("widget_vector"))
         widget_vector.setParent(graph_widget.groupBox)
         graph_widget.gridLayout_3.addWidget(widget_vector, 0, 0, 1, 1)
         
         graph_widget.label.setText("%1.6f" % self.GAs[indice])
         
         vect_widget = Detail_widget()
         vect_widget.setup()
         
         widget_vector_tab = FigureWidget(self.figuras_vet[indice])
         widget_vector_tab.setObjectName(_fromUtf8("widget_vector_tab"))
         widget_vector_tab.setParent(vect_widget.groupBox)
         vect_widget.gridLayout_1.addWidget(widget_vector_tab, 0, 0, 1, 1)
         
         navbar_vetor = Navbar(widget_vector_tab, self.ui.ui.centralwidget)
         vect_widget.gridLayout_2.addWidget(navbar_vetor, 0, 0, 1, 1)
         
         trian_widget = Detail_widget()
         trian_widget.setup()
         
         widget_delaunay_tab = FigureWidget(self.figuras_triang[indice])
         widget_delaunay_tab.setObjectName(_fromUtf8("widget_delaunay_tab"))
         widget_delaunay_tab.setParent(trian_widget.groupBox)
         trian_widget.gridLayout_1.addWidget(widget_delaunay_tab, 0, 0, 1, 1)
         
         navbar_delaunay = Navbar(widget_delaunay_tab, self.ui.ui.centralwidget)
         trian_widget.gridLayout_2.addWidget(navbar_delaunay, 0, 0, 1, 1)
     
         widget_gpa_ev = FigureWidget(self.figuras_GA[indice])
         widget_gpa_ev.setObjectName(_fromUtf8("widget_gpa_ev"))
         widget_gpa_ev.setParent(self.ui.ui.GPAGraphGroup)
         
         self.ui.ui.stackedGraphics.addWidget(graph_widget)
         self.ui.ui.stackedVet.addWidget(vect_widget)
         self.ui.ui.stackedTriang.addWidget(trian_widget)
         self.ui.ui.stackedGPA.addWidget(widget_gpa_ev)
         
     self.ui.ui.horizontalSlider.setMaximum(len(self.matrizes) - 1)
     self.ui.ui.horizontalSlider.setSingleStep(1)
     self.ui.ui.horizontalSlider.setPageStep(1)
开发者ID:jcemelanda,项目名称:PyGPA2.0,代码行数:56,代码来源:control_analisys.py

示例2: ValueWidget

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setObjectName [as 别名]
class ValueWidget(QWidget, Ui_Widget):

    def __init__(self, iface):

        self.hasqwt=hasqwt
        self.hasmpl=hasmpl
        self.layerMap=dict()
        self.statsChecked=False
        self.ymin=0
        self.ymax=250

        self.iface=iface
        self.canvas=self.iface.mapCanvas()
        self.legend=self.iface.legendInterface()
        self.logger = logging.getLogger('.'.join((__name__, 
                                        self.__class__.__name__)))

        QWidget.__init__(self)
        self.setupUi(self)
        self.setupUi_extra()

        QObject.connect(self.cbxActive,SIGNAL("stateChanged(int)"),self.changeActive)
        QObject.connect(self.cbxGraph,SIGNAL("stateChanged(int)"),self.changePage)
        QObject.connect(self.canvas, SIGNAL( "keyPressed( QKeyEvent * )" ), self.pauseDisplay )
        QObject.connect(self.plotSelector, SIGNAL( "currentIndexChanged ( int )" ), self.changePlot )

    def setupUi_extra(self):

        # checkboxes
        #self.changeActive(Qt.Checked)
        #set inactive by default - should save last state in user config
        self.cbxActive.setCheckState(Qt.Unchecked)

        # plot
        self.plotSelector.setVisible( False )
        self.cbxStats.setVisible( False )
        self.graphControls.setVisible( False )
        if self.hasqwt:
            self.plotSelector.addItem( 'Qwt' )
        if self.hasmpl:
            self.plotSelector.addItem( 'mpl' )
        self.plotSelector.setCurrentIndex( 0 );
        if (not self.hasqwt or not self.hasmpl):
            #self.plotSelector.setVisible(False)
            self.plotSelector.setEnabled(False)

        # Page 2 - qwt
        if self.hasqwt:
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse,
                          QBrush(Qt.white),
                          QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)
            self.qwtPlot.setVisible(False)
        else:
            self.qwtPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.qwtPlot.updateGeometry()
        self.stackedWidget.addWidget(self.qwtPlot)

        #Page 3 - matplotlib
        self.mplLine = None #make sure to invalidate when layers change
        if self.hasmpl:
            # mpl stuff
            # should make figure light gray
            self.mplBackground = None #http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
            self.mplFig.subplots_adjust(left=0.1, right=0.975, bottom=0.13, top=0.95)
            self.mplPlt = self.mplFig.add_subplot(111)   
            self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
            self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)                           
            # qt stuff
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
            self.mplPlot.setVisible(False)
        else:
            self.mplPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mplPlot.sizePolicy().hasHeightForWidth())
        self.mplPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.setObjectName("qwtPlot")
        self.mplPlot.updateGeometry()
        self.stackedWidget.addWidget(self.mplPlot)
#.........这里部分代码省略.........
开发者ID:blazek,项目名称:valuetool,代码行数:103,代码来源:valuewidget.py

示例3: Ui_MainWindow

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setObjectName [as 别名]
class Ui_MainWindow(object):
    def __init__(self):

        self.ms = 5
        self.lw = 1.1
        self.e_capthick = 1
        self.e_capsize = 5

        # color mode
        self.cted = (0, 0, 1)
        self.ctmd = (1, 0, 0)
        self.ctrd = (0.5, 0.5, 0)
        self.ctid = (0, 0.5, 0.5)
        self.mted = "s"
        self.mtmd = "o"

        # color for occam2d model
        self.ctem = (0, 0.6, 0.3)
        self.ctmm = (0.9, 0, 0.8)
        self.ctrm = (0.9, 0.4, 0.2)
        self.ctim = (0.2, 0.4, 0.9)

        self.mtem = self.mted
        self.mtmm = self.mtmd

        self.res_xx_limits = None
        self.res_xy_limits = None
        self.res_yx_limits = None
        self.res_yy_limits = None

        self.phase_xx_limits = None
        self.phase_xy_limits = None
        self.phase_yx_limits = None
        self.phase_yy_limits = None

        self.subplot_wspace = 0.25
        self.subplot_hspace = 0.0
        self.subplot_right = 0.98
        self.subplot_left = 0.08
        self.subplot_top = 0.90
        self.subplot_bottom = 0.08

        self.legend_loc = "upper center"
        self.legend_pos = (0.5, 1.22)
        self.legend_marker_scale = 1
        self.legend_border_axes_pad = 0.01
        self.legend_label_spacing = 0.07
        self.legend_handle_text_pad = 0.2
        self.legend_border_pad = 0.15

        self.fs = 11

        self.plot_component = 4
        self.plot_tipper = True
        self.plot_z = True
        self.ylabel_pad = 1.25
        self.station = None

        self.modem_data = None
        self.modem_resp = None
        self.dirpath = os.getcwd()

    def setupUi(self, MainWindow):
        MainWindow.setWindowTitle("Plot ModEM MT Response")
        MainWindow.resize(1920, 1080)

        # make a central widget that everything is tied to.
        self.central_widget = QtGui.QWidget(MainWindow)
        self.central_widget.setWindowTitle("Plot MT Response")

        # make a widget that will be the station list
        self.list_widget = QtGui.QListWidget()
        self.list_widget.itemClicked.connect(self.get_station)
        self.list_widget.setMaximumWidth(150)

        # this is the Canvas Widget that displays the `figure`
        # it takes the `figure` instance as a parameter to __init__
        self.figure = Figure(dpi=150)
        self.mpl_widget = FigureCanvas(self.figure)

        # make sure the figure takes up the entire plottable space
        self.mpl_widget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)

        # this is the Navigation widget
        # it takes the Canvas widget and a parent
        self.mpl_toolbar = NavigationToolbar(self.mpl_widget, MainWindow)

        # set the layout for the plot
        mpl_vbox = QtGui.QVBoxLayout()
        mpl_vbox.addWidget(self.mpl_toolbar)
        mpl_vbox.addWidget(self.mpl_widget)

        # set the layout the main window
        layout = QtGui.QHBoxLayout()
        layout.addWidget(self.list_widget)
        layout.addLayout(mpl_vbox)
        self.central_widget.setLayout(layout)

        # set the geometry of each widget
        self.list_widget.setObjectName(_fromUtf8("listWidget"))
#.........这里部分代码省略.........
开发者ID:GeoscienceAustralia,项目名称:mtpy,代码行数:103,代码来源:modem_plot_response_faster.py

示例4: ValueWidget

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setObjectName [as 别名]
class ValueWidget(QWidget, Ui_Widget):

    def __init__(self, iface):

        self.hasqwt=hasqwt
        self.hasmpl=hasmpl
        self.layerMap=dict()
        self.statsChecked=False
        self.ymin=0
        self.ymax=250
        self.isActive=False

        # Statistics (>=1.9)
        self.statsSampleSize = 2500000
        self.stats = {} # stats per layer

        self.layersSelected=[]
        self.layerBands=dict()

        self.iface=iface
        self.canvas=self.iface.mapCanvas
        self.legend=self.iface.legendInterface()
        self.logger = logging.getLogger('.'.join((__name__, 
                                        self.__class__.__name__)))

        QWidget.__init__(self)
        self.setupUi(self)
        self.tabWidget.setEnabled(False)
        self.cbxClick.setChecked( QSettings().value('plugins/valuetool/mouseClick', False, type=bool ) )

        #self.setupUi_plot()
        #don't setup plot until Plot tab is clicked - workaround for bug #7450
        #qgis will still crash in some cases, but at least the tool can be used in Table mode
        self.qwtPlot = None
        self.mplPlot = None
        self.mplLine = None

        QObject.connect(self.plotSelector, SIGNAL( "currentIndexChanged ( int )" ), self.changePlot )
        QObject.connect(self.tabWidget, SIGNAL( "currentChanged ( int )" ), self.tabWidgetChanged )
        QObject.connect(self.cbxLayers, SIGNAL( "currentIndexChanged ( int )" ), self.updateLayers )
        QObject.connect(self.cbxBands, SIGNAL( "currentIndexChanged ( int )" ), self.updateLayers )
        QObject.connect(self.tableWidget2, SIGNAL("cellChanged ( int , int )"), self.layerSelected)

    def setupUi_plot(self):

        # plot
        self.plotSelector.setVisible( False )
        self.cbxStats.setVisible( False )
        # stats by default because estimated are fast
        self.cbxStats.setChecked( True )
        self.plotSelector.addItem( 'Qwt' )
        self.plotSelector.addItem( 'mpl' )

        # Page 2 - qwt
        if self.hasqwt:
            self.qwtPlot = QwtPlot(self.stackedWidget)
            self.qwtPlot.setAutoFillBackground(False)
            self.qwtPlot.setObjectName("qwtPlot")
            self.curve = QwtPlotCurve()
            self.curve.setSymbol(
                QwtSymbol(QwtSymbol.Ellipse,
                          QBrush(Qt.white),
                          QPen(Qt.red, 2),
                          QSize(9, 9)))
            self.curve.attach(self.qwtPlot)
        else:
            self.qwtPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.qwtPlot.sizePolicy().hasHeightForWidth())
        self.qwtPlot.setSizePolicy(sizePolicy)
        self.qwtPlot.updateGeometry()
        self.stackedWidget.addWidget(self.qwtPlot)

        #Page 3 - matplotlib
        self.mplLine = None #make sure to invalidate when layers change
        if self.hasmpl:
            # mpl stuff
            # should make figure light gray
            self.mplBackground = None #http://www.scipy.org/Cookbook/Matplotlib/Animations
            self.mplFig = plt.Figure(facecolor='w', edgecolor='w')
            self.mplFig.subplots_adjust(left=0.1, right=0.975, bottom=0.13, top=0.95)
            self.mplPlt = self.mplFig.add_subplot(111)   
            self.mplPlt.tick_params(axis='both', which='major', labelsize=12)
            self.mplPlt.tick_params(axis='both', which='minor', labelsize=10)                           
            # qt stuff
            self.pltCanvas = FigureCanvasQTAgg(self.mplFig)
            self.pltCanvas.setParent(self.stackedWidget)
            self.pltCanvas.setAutoFillBackground(False)
            self.pltCanvas.setObjectName("mplPlot")
            self.mplPlot = self.pltCanvas
        else:
            self.mplPlot = QtGui.QLabel("Need Qwt >= 5.0 or matplotlib >= 1.0 !")

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.mplPlot.sizePolicy().hasHeightForWidth())
#.........这里部分代码省略.........
开发者ID:waneric,项目名称:PyMapLib,代码行数:103,代码来源:valuewidget.py

示例5: ui_janela_principal

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setObjectName [as 别名]
class ui_janela_principal(object):
    '''
    class ui_janela_principal
    
    Classe que define a interfacegráfica do programa PyGPA
    
    Métodos:
        setup_ui -> None
        retranslate_ui -> None
    '''
    def __init__(self, controle):
        self.controle = controle


    def setup_ui(self, janela_principal):
        '''
        setup_ui -> None
        
        Configura a interface gráfica, seus elementos e faz a ligação entre
        elementos gráficos e métodos do controle.
        '''
        
        janela_principal.setObjectName(_fromUtf8("janela_principal"))
        janela_principal.setWindowModality(QtCore.Qt.ApplicationModal)
        janela_principal.resize(1024, 768)
        
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8("icons/icon.png")),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        janela_principal.setWindowIcon(icon)
        
        self.widget_central = QtGui.QWidget(janela_principal)
        self.widget_central.setObjectName(_fromUtf8("widget_central"))
        self.gridLayout = QtGui.QGridLayout(self.widget_central)
        self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
        self.Tabs = QtGui.QTabWidget(self.widget_central)
        self.Tabs.setObjectName(_fromUtf8("Tabs"))
        
        self.graphicPage1 = QtGui.QWidget()
        self.graphicPage1.setObjectName(_fromUtf8("graphicPage1"))
        self.gridLayout_3 = QtGui.QGridLayout(self.graphicPage1)
        self.gridLayout_3.setObjectName(_fromUtf8("gridLayout_3"))
        self.GPAGrid = QtGui.QGridLayout()
        self.GPAGrid.setObjectName(_fromUtf8("GPAGrid"))
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.GPAGrid.addItem(spacerItem, 2, 0, 1, 1)
        spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.GPAGrid.addItem(spacerItem1, 0, 0, 1, 1)
        self.GPAGroup = QtGui.QGroupBox(self.graphicPage1)
        self.GPAGroup.setObjectName(_fromUtf8("GPAGroup"))
        self.gridLayout_5 = QtGui.QGridLayout(self.GPAGroup)
        self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
        self.GPALabel = QtGui.QLabel(self.GPAGroup)
        self.GPALabel.setObjectName(_fromUtf8("GPALabel"))
        self.gridLayout_5.addWidget(self.GPALabel, 0, 0, 1, 1)
        self.GPAGrid.addWidget(self.GPAGroup, 1, 0, 1, 1)
        self.gridLayout_3.addLayout(self.GPAGrid, 1, 2, 1, 1)
        
        self.delaunayGroup = QtGui.QGroupBox(self.graphicPage1)
        self.delaunayGroup.setObjectName(_fromUtf8("delaunayGroup"))
        self.gridLayout_4 = QtGui.QGridLayout(self.delaunayGroup)
        self.gridLayout_4.setObjectName(_fromUtf8("gridLayout_4"))
        
        self.delaunay_figure = Figure(dpi = 120)
        self.widget_delaunay = FigureWidget(self.delaunay_figure)
        self.widget_delaunay.setObjectName(_fromUtf8("widget_delaunay"))
        self.widget_delaunay.setParent(self.delaunayGroup)
        self.delaunay_axes = self.delaunay_figure.add_subplot(111, aspect = 'equal')
        self.gridLayout_4.addWidget(self.widget_delaunay, 0, 0, 1, 1)
        self.gridLayout_3.addWidget(self.delaunayGroup, 1, 1, 1, 1)
        self.vetfieldGroup = QtGui.QGroupBox(self.graphicPage1)
        self.vetfieldGroup.setObjectName(_fromUtf8("vetfieldGroup"))
        self.gridLayout_9 = QtGui.QGridLayout(self.vetfieldGroup)
        self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9"))
        
        self.vector_figure = Figure(dpi = 120)
        self.widget_vector = FigureWidget(self.vector_figure)
        self.widget_vector.setObjectName(_fromUtf8("widget_vector"))
        self.widget_vector.setParent(self.vetfieldGroup)
        self.vector_axes = self.vector_figure.add_subplot(111, aspect = 'equal')
        self.gridLayout_9.addWidget(self.widget_vector, 0, 0, 1, 1)
        self.gridLayout_3.addWidget(self.vetfieldGroup, 1, 0, 1, 1)
        self.gridLayout_3.setColumnStretch(0, 8)
        self.gridLayout_3.setColumnStretch(1, 8)
        self.gridLayout_3.setColumnStretch(2, 1)
        self.Tabs.addTab(self.graphicPage1, _fromUtf8(""))
        self.vectorTab = QtGui.QWidget()
        self.vectorTab.setObjectName(_fromUtf8("vectorTab"))
        self.gridLayout_6 = QtGui.QGridLayout(self.vectorTab)
        self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6"))
        self.vetGroupTab = QtGui.QGroupBox(self.vectorTab)
        self.vetGroupTab.setObjectName(_fromUtf8("vetGroupTab"))
        self.gridLayout_12 = QtGui.QGridLayout(self.vetGroupTab)
        self.gridLayout_12.setObjectName(_fromUtf8("gridLayout_12"))
        
        self.vector_figure_tab = Figure(dpi = 120)
        self.widget_vector_tab = FigureWidget(self.vector_figure_tab)
        self.widget_vector_tab.setObjectName(_fromUtf8("widget_vector_tab"))
        self.widget_vector_tab.setParent(self.vetGroupTab)
        self.vector_tab_axes = self.vector_figure_tab.add_subplot(111, aspect = 'equal')
#.........这里部分代码省略.........
开发者ID:jcemelanda,项目名称:PyGPA,代码行数:103,代码来源:GUI.py

示例6: Ui_Monitor

# 需要导入模块: from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg [as 别名]
# 或者: from matplotlib.backends.backend_qt4agg.FigureCanvasQTAgg import setObjectName [as 别名]
class Ui_Monitor(object):
    def setupUi(self, Monitor):
        Monitor.setObjectName(_fromUtf8("Monitor"))
        Monitor.resize(649, 388)
        self._plabel = []
        self._port = []
        self._display = []
        ## port
        self.SetPort(Monitor)
        # port label
        self.SetLabel(Monitor)
        # lcd number
        self.SetLcdDisplay(Monitor)

        font = QtGui.QFont()
        font.setPointSize(11)

        self._start = QtGui.QPushButton(Monitor)
        self._start.setGeometry(QtCore.QRect(10, 240, 91, 21))
        self._start.setFont(font)
        self._start.setObjectName(_fromUtf8("_start"))
        self._stop = QtGui.QPushButton(Monitor)
        self._stop.setGeometry(QtCore.QRect(10, 270, 91, 21))
        self._stop.setFont(font)
        self._stop.setObjectName(_fromUtf8("_stop"))
        self._quit = QtGui.QPushButton(Monitor)
        self._quit.setGeometry(QtCore.QRect(10, 300, 91, 21))
        self._quit.setFont(font)
        self._quit.setObjectName(_fromUtf8("_quit"))

        # matplotlib canvas
        self._fig = Figure(facecolor="whitesmoke")
        self.plot = FigureCanvas(self._fig)
        self.plot.setGeometry(QtCore.QRect(120, 10, 521, 371))
        self.plot.setObjectName(_fromUtf8("monitor"))
        self.plot.setParent(Monitor)

        self.retranslateUi(Monitor)
        QtCore.QObject.connect(self._quit, QtCore.SIGNAL(_fromUtf8("clicked()")), Monitor.close)
        QtCore.QMetaObject.connectSlotsByName(Monitor)

    def retranslateUi(self, Monitor):
        Monitor.setWindowTitle(_translate("Monitor", "Form", None))
        self._start.setText(_translate("Monitor", "Start", None))
        self._stop.setText(_translate("Monitor", "Stop", None))
        self._quit.setText(_translate("Monitor", "Quit", None))

    ## set port label
    def SetLabel(self, mainwin):
        numoflabel = 3
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setBold(False)
        font.setItalic(False)
        font.setWeight(50)

        for i in range(numoflabel):
            self._plabel.append( QtGui.QLabel(mainwin) )
        self._plabel[0].setGeometry(QtCore.QRect(10, 30, 101, 21))
        self._plabel[1].setGeometry(QtCore.QRect(10, 70, 101, 21))
        self._plabel[2].setGeometry(QtCore.QRect(10, 110, 101, 21))

        for i in range(len(self._plabel)):
            self._plabel[i].setFont(font)
            self._plabel[i].setText(_fromUtf8( "Port %i" %(i+1) ))
            self._plabel[i].setTextFormat(QtCore.Qt.AutoText)
            self._plabel[i].setScaledContents(False)
            self._plabel[i].setAlignment(QtCore.Qt.AlignCenter)
            self._plabel[i].setWordWrap(False)
            self._plabel[i].setObjectName(_fromUtf8( "_pLabel%i" %(i+1) ))

    ## set port address
    def SetPort(self, mainwin):
        numofport = 3
        for i in range(numofport):
            self._port.append( QtGui.QSpinBox(mainwin) )

        self._port[0].setGeometry(QtCore.QRect(10, 10, 101, 21))
        self._port[0].setProperty("value", 20)
        self._port[1].setGeometry(QtCore.QRect(10, 50, 101, 21))
        self._port[1].setProperty("value", 6)
        self._port[2].setGeometry(QtCore.QRect(10, 90, 101, 21))
        self._port[2].setProperty("value", 12)
        for i in range(len(self._port)):
            self._port[i].setObjectName(_fromUtf8("_port%i" %(i+1)))


    ## set lcd display
    def SetLcdDisplay(self, mainwin):
        numoflcd = 3
        font = QtGui.QFont()
        font.setFamily(_fromUtf8("Symbol"))
        font.setPointSize(13)
        font.setBold(True)
        font.setWeight(75)

        for i in range(numoflcd):
            self._display.append( QtGui.QLCDNumber(mainwin) )

        self._display[0].setGeometry(QtCore.QRect(10, 140, 91, 16))
#.........这里部分代码省略.........
开发者ID:kanouyou,项目名称:daqhts,代码行数:103,代码来源:PyMonitorGui.py


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