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


Python QGraphicsPixmapItem.setPos方法代码示例

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


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

示例1: createPixmapItem

# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import setPos [as 别名]
 def createPixmapItem(self, pixmap, position, matrix=QMatrix()):
     item = QGraphicsPixmapItem(pixmap)
     item.setFlags(QGraphicsItem.ItemIsSelectable|
                   QGraphicsItem.ItemIsMovable)
     item.setPos(position)
     item.setMatrix(matrix)
     self.scene.clearSelection()
     self.scene.addItem(item)
     item.setSelected(True)
开发者ID:pyros2097,项目名称:SabelIDE,代码行数:11,代码来源:designer.py

示例2: inicializarUI

# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import setPos [as 别名]
    def inicializarUI(self):
        self.setWindowTitle("BlueKing::Reversa")
        self.setGeometry(0,0,320,240)
        self.setAutoFillBackground(True)

        #QGraphicsView/Scene
        self.view = QGraphicsView()
        self.view.setStyleSheet("border: 0px;margin: 0px;background-color: #000000;")

        self.scene = QGraphicsScene(0,0,320,240)
        self.view.setScene(self.scene)

        self.baseLayout = QVBoxLayout()
        self.baseLayout.setContentsMargins(0,0,0,0)
        self.baseLayout.addWidget(self.view)

        #Decoracion
        car_logo = QPixmap("imagenes/car_logo.png")
        car_logo_item = QGraphicsPixmapItem(car_logo)
        car_logo_item.setPos(5,5)
        self.scene.addItem(car_logo_item)

        self.distlabel = QLabel("-")
        self.distlabel.setGeometry(20, 20, 280, 200)
        self.distlabel.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        self.distlabel.setStyleSheet("color: #00FFFF;font-size: 150px;background-color: transparent;")
        self.scene.addWidget(self.distlabel)

        self.measureLabel=QLabel("metros")
        self.measureLabel.setGeometry(10,190,300,30)
        self.measureLabel.setAlignment(QtCore.Qt.AlignRight |QtCore.Qt.AlignVCenter)
        self.measureLabel.setStyleSheet("color: #FFFF00;font-size: 30px; font-weight: bold; font-style: italic;background-color: transparent;")
        self.scene.addWidget(self.measureLabel)

        self.setLayout(self.baseLayout)

        transformacion = QTransform()
        transformacion.scale(1.0,-1.0)

        #self.view.setTransform(transformacion)

        self.show()
开发者ID:razorblade446,项目名称:BlueKing,代码行数:44,代码来源:BKReversaScreen.py

示例3: ProbabilitiesItem

# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import setPos [as 别名]
class ProbabilitiesItem(orangeqt.PlotItem):
    """
        Displays class probabilities in the background

        :param classifier: The classifier for which the probabilities are calculated
        :type classifier: orange.P2NN

        :param granularity: The size of individual cells
        :type granularity: int

        :param scale: The data scale factor
        :type scale: float

        :param spacing: The space between cells
        :param spacing: int

        :param rect: The rectangle into which to draw the probabilities. If unspecified, the entire plot is used.
        :type rect: QRectF
    """

    def __init__(self, classifier, granularity, scale, spacing, rect=None):
        orangeqt.PlotItem.__init__(self)
        self.classifier = classifier
        self.rect = rect
        self.granularity = granularity
        self.scale = scale
        self.spacing = spacing
        self.pixmap_item = QGraphicsPixmapItem(self)
        self.set_in_background(True)
        self.setZValue(ProbabilitiesZValue)

    def update_properties(self):
        ## Mostly copied from OWScatterPlotGraph
        if not self.plot():
            return

        if not self.rect:
            x, y = self.axes()
            self.rect = self.plot().data_rect_for_axes(x, y)
        s = self.graph_transform().mapRect(self.rect).size().toSize()
        if not s.isValid():
            return
        rx = s.width()
        ry = s.height()

        rx -= rx % self.granularity
        ry -= ry % self.granularity

        p = self.graph_transform().map(QPointF(0, 0)) - self.graph_transform().map(self.rect.topLeft())
        p = p.toPoint()

        ox = p.x()
        oy = -p.y()

        if isinstance(self.classifier.classVar, ContinuousVariable):
            imagebmp = orangeom.potentialsBitmap(self.classifier, rx, ry, ox, oy, self.granularity, self.scale)
            palette = [qRgb(255.0 * i / 255.0, 255.0 * i / 255.0, 255 - (255.0 * i / 255.0)) for i in range(255)] + [
                qRgb(255, 255, 255)
            ]
        else:
            imagebmp, nShades = orangeom.potentialsBitmap(
                self.classifier, rx, ry, ox, oy, self.granularity, self.scale, self.spacing
            )
            palette = []
            sortedClasses = get_variable_values_sorted(self.classifier.domain.classVar)
            for cls in self.classifier.classVar.values:
                color = self.plot().discPalette.getRGB(sortedClasses.index(cls))
                towhite = [255 - c for c in color]
                for s in range(nShades):
                    si = 1 - float(s) / nShades
                    palette.append(qRgb(*tuple([color[i] + towhite[i] * si for i in (0, 1, 2)])))
            palette.extend([qRgb(255, 255, 255) for i in range(256 - len(palette))])

        self.potentialsImage = QImage(imagebmp, rx, ry, QImage.Format_Indexed8)
        self.potentialsImage.setColorTable(ColorPaletteDlg.signedPalette(palette) if qVersion() < "4.5" else palette)
        self.potentialsImage.setNumColors(256)
        self.pixmap_item.setPixmap(QPixmap.fromImage(self.potentialsImage))
        self.pixmap_item.setPos(self.graph_transform().map(self.rect.bottomLeft()))

    def data_rect(self):
        return self.rect if self.rect else QRectF()
开发者ID:nedaeh,项目名称:vpe,代码行数:83,代码来源:owtools.py

示例4: inicializarUI

# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import setPos [as 别名]
    def inicializarUI(self):
        self.setWindowTitle("BlueKing HUD")
        self.setGeometry(0,0,320,240)
        self.setAutoFillBackground(True)

        self.view = QGraphicsView()
        self.view.setStyleSheet("border: 0px;margin: 0px;background-color: #000000;")

        self.scene = QGraphicsScene(0,0,320,240)
        self.view.setScene(self.scene)

        self.baseLayout = QVBoxLayout()
        self.baseLayout.setContentsMargins(0,0,0,0)
        self.baseLayout.addWidget(self.view)

        # Decoracion
        car_logo = QPixmap("imagenes/car_logo.png").scaled(32,32, QtCore.Qt.KeepAspectRatio)
        car_logo_item = QGraphicsPixmapItem(car_logo)
        car_logo_item.setPos(5,5)
        self.scene.addItem(car_logo_item)

        # Etiqueta km/h
        kmLabel = QLabel("Km/h")
        kmLabel.setGeometry(250,120, 70, 25)
        kmLabel.setStyleSheet("font-size: 25px; color: #C8FF00; background: transparent;text-decoration: italic")
        self.scene.addWidget(kmLabel)

        # Etiqueta RPM
        rpmSigLabel = QLabel("R.P.M.")
        rpmSigLabel.setGeometry(250, 152, 70, 25)
        rpmSigLabel.setStyleSheet("font-size: 25px; color: #C8FF00; background: transparent;text-decoration: italic")
        self.scene.addWidget(rpmSigLabel)

        # Icono Temperatura
        thermometro = QPixmap("imagenes/termometro_rojo.png").scaled(25,25, QtCore.Qt.KeepAspectRatio)
        thermometro_item = QGraphicsPixmapItem(thermometro)
        thermometro_item.setPos(290, 210)
        self.scene.addItem(thermometro_item)

        # Indicadores
        # Velocidad
        self.gaugeWidget = BKGauge()
        self.gaugeWidget.setGeometry(70,50,180,180)
        self.gaugeWidget.colorDial="#00FF00"
        self.gaugeWidget.maxValor=250
        self.scene.addWidget(self.gaugeWidget)

        self.velocidadLabel = QLabel("250")
        self.velocidadLabel.setGeometry(115,90,130,60)
        self.velocidadLabel.setAlignment(QtCore.Qt.AlignRight |QtCore.Qt.AlignVCenter)
        self.velocidadLabel.setStyleSheet("font-family: Blutter;font-size: 60px;color: #00FFFF; background: transparent; font-weight: bold; text-align: right;")
        self.scene.addWidget(self.velocidadLabel)

        # RPM
        self.rpmGaugeWidget = BKGauge()
        self.rpmGaugeWidget.setGeometry(60, 40, 200, 200)
        self.rpmGaugeWidget.maxValor=25000
        self.rpmGaugeWidget.anchoLinea = 20
        self.rpmGaugeWidget.colorDial = "#FF0000"
        self.scene.addWidget(self.rpmGaugeWidget)

        self.rpmLabel = QLabel("2658")
        self.rpmLabel.setGeometry(160, 150, 85, 30)
        self.rpmLabel.setAlignment(QtCore.Qt.AlignRight |QtCore.Qt.AlignVCenter)
        self.rpmLabel.setStyleSheet("font-family: Blutter;font-size: 30px;color: #FF0009; background-color: transparent;")
        self.scene.addWidget(self.rpmLabel)

        # Temperatura Motor
        self.engTempLabel = QLabel("180")
        self.engTempLabel.setGeometry(240, 210, 50, 25)
        self.engTempLabel.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter)
        self.engTempLabel.setStyleSheet("font-family: Blutter; font-size: 20px; color: #00FF00;background-color: transparent;")
        self.scene.addWidget(self.engTempLabel)

        self.setLayout(self.baseLayout)

        transformacion = QTransform()
        transformacion.scale(1.0,-1.0)

        self.view.setTransform(transformacion)

        self.show()
开发者ID:razorblade446,项目名称:BlueKing,代码行数:84,代码来源:BKHudScreen.py


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