本文整理汇总了Python中PyQt4.QtGui.QGraphicsPixmapItem.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsPixmapItem.__init__方法的具体用法?Python QGraphicsPixmapItem.__init__怎么用?Python QGraphicsPixmapItem.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsPixmapItem
的用法示例。
在下文中一共展示了QGraphicsPixmapItem.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import __init__ [as 别名]
def __init__(self, *args):
self.seleccionado = False
self.velocity = random.randint(1,10)
QGraphicsPixmapItem.__init__(self, *args)
self.setPixmap(QPixmap("sprites/"+str(random.randint(1,45))+".png"))
self.setTransformOriginPoint(self.boundingRect().width()/2.0,self.boundingRect().height()/2.0)
self.setZValue(10)
##menu contextual
self.menu = QMenu()
self.Actions =[] #arreglo de acciones
self.Actions.append( self.menu.addAction("Seguir") )
self.Actions.append( self.menu.addAction("Editar") )
self.Actions.append( self.menu.addAction("girar clockwise") )
self.Actions.append( self.menu.addAction("girar anti-clockwise") )
self.Actions.append( self.menu.addAction("Colisiones") )
self.Actions.append( self.menu.addAction("Duplicar") )
self.Actions.append( self.menu.addAction("Eliminar") )
self.menu.triggered[QAction].connect(self.test)
##offset para el arrastre
self.offset= QPointF(0,0)
##poligono de vision
poligono = QPolygonF()
poligono.append(QPointF(-1,10))
poligono.append(QPointF(-1,20))
poligono.append(QPointF(-30,40))
poligono.append(QPointF(-40,15))
poligono.append(QPointF(-30,-10))
self.vision = QGraphicsPolygonItem(poligono,self,self.scene())
self.vision.setBrush(QColor(255, 255, 0,100))
self.vision.setPen(QColor(255, 255, 0))
示例2: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import __init__ [as 别名]
def __init__(self, data, encoding, x0, y0, x1, y1, xsize, ysize):
p = QPixmap()
p.loadFromData(data, encoding, Qt.AutoColor)
w, h = p.width(), p.height()
p = p.copy(x0, y0, min(w, x1-x0), min(h, y1-y0))
if p.width() != xsize or p.height() != ysize:
p = p.scaled(xsize, ysize, Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
QGraphicsPixmapItem.__init__(self, p)
self.height, self.width = ysize, xsize
self.setTransformationMode(Qt.SmoothTransformation)
self.setShapeMode(QGraphicsPixmapItem.BoundingRectShape)
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import __init__ [as 别名]
def __init__(self, *args):
QGraphicsPixmapItem.__init__(self, *args)
self.setPixmap(QPixmap("sprites/calle/centro.png"))
self.setTransformOriginPoint(self.boundingRect().width()/2.0,self.boundingRect().height()/2.0)
self.setZValue(1)
self.menu = QMenu()
self.Actions =[] #arreglo de acciones
self.Actions.append( self.menu.addAction("girar clockwise") )
self.Actions.append( self.menu.addAction("girar anti-clockwise") )
self.Actions.append( self.menu.addAction("Duplicar") )
self.Actions.append( self.menu.addAction("Eliminar") )
self.menu.triggered[QAction].connect(self.test)
self.offset=QPointF(0,0)
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import __init__ [as 别名]
def __init__(self, face, node, pixmap):
QGraphicsPixmapItem.__init__(self, pixmap)
_ActionDelegator.__init__(self)
self.node = node
示例5: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import __init__ [as 别名]
def __init__(self, pathway, objects, *args, **kwargs):
QGraphicsPixmapItem.__init__(self, *args)
self.setTransformationMode(Qt.SmoothTransformation)
self.setPathway(pathway)
self.setMarkedObjects(objects,
name_mapper=kwargs.get("name_mapper", {}))
示例6: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import __init__ [as 别名]
def __init__(self, face, pixmap):
QGraphicsPixmapItem.__init__(self, pixmap)
示例7: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsPixmapItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsPixmapItem import __init__ [as 别名]
def __init__(self, icon=None, parent=None):
QGraphicsPixmapItem.__init__(self, QPixmap(":" + icon), parent)
self.setShapeMode(QGraphicsPixmapItem.BoundingRectShape)
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
self._moveCheckpoint = None
self._lines = []