本文整理汇总了Python中PyQt4.QtGui.QGraphicsScene方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QGraphicsScene方法的具体用法?Python QtGui.QGraphicsScene怎么用?Python QtGui.QGraphicsScene使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QGraphicsScene方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showCode
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsScene [as 别名]
def showCode(self):
pixmap = QtGui.QPixmap()
pixmap.load("api/code.jpg")
pixmap.scaledToHeight(60)
pixmap.scaledToWidth(120)
self.scene_code = QtGui.QGraphicsScene(self)
item = QtGui.QGraphicsPixmapItem(pixmap)
self.scene_code.addItem(item)
self.ui.img_code.setScene(self.scene_code)
self.resize(257, 235)
self.ui.lbl_code.setGeometry(QtCore.QRect(20, 110, 63, 18))
self.ui.text_code.setGeometry(QtCore.QRect(70, 100, 113, 28))
self.ui.img_code.setGeometry(QtCore.QRect(60, 130, 120, 50))
self.ui.btn_login.setGeometry(QtCore.QRect(20, 190, 93, 27))
self.ui.btn_cancel.setGeometry(QtCore.QRect(140, 190, 93, 27))
self.ui.lbl_code.show()
self.ui.text_code.show()
self.ui.img_code.show()
# chat
示例2: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsScene [as 别名]
def __init__(self):
QGraphicsView.__init__(self)
# Image is displayed as a QPixmap in a QGraphicsScene attached to this QGraphicsView.
self.scene = QGraphicsScene()
self.setScene(self.scene)
# Store a local handle to the scene's current image pixmap.
self._pixmapHandle = None
# Image aspect ratio mode.
# !!! ONLY applies to full image. Aspect ratio is always ignored when zooming.
# Qt.IgnoreAspectRatio: Scale image to fit viewport.
# Qt.KeepAspectRatio: Scale image to fit inside viewport, preserving aspect ratio.
# Qt.KeepAspectRatioByExpanding: Scale image to fill the viewport, preserving aspect ratio.
self.aspectRatioMode = Qt.KeepAspectRatio
# Scroll bar behaviour.
# Qt.ScrollBarAlwaysOff: Never shows a scroll bar.
# Qt.ScrollBarAlwaysOn: Always shows a scroll bar.
# Qt.ScrollBarAsNeeded: Shows a scroll bar only when zoomed.
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded)
# Stack of QRectF zoom boxes in scene coordinates.
self.zoomStack = []
# Flags for enabling/disabling mouse interaction.
self.canZoom = True
self.canPan = True
示例3: setupSelf
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsScene [as 别名]
def setupSelf(self,main,account,lnick):
pixmap = QtGui.QPixmap()
pixmap.load('tmp/head/' + str(account) + '.jpg')
scene = QtGui.QGraphicsScene(main)
item = QtGui.QGraphicsPixmapItem(pixmap)
scene.addItem(item)
self.img_head.setScene(scene)
self.lbl_head.setText(_translate("Main", str(account), None))
self.lbl_content.setText(_translate("Main", lnick, None))
示例4: setupFace
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsScene [as 别名]
def setupFace(self, main,data):
for i in range(len(data['friends'])):
name = str(data['friends'][i]['uin'])
pixmap = QtGui.QPixmap()
if not os.path.exists('tmp/head/'+name+'.jpg'):
name = 'qq'
pixmap.load('tmp/head/' + name + '.jpg')
scene = QtGui.QGraphicsScene(main)
item = QtGui.QGraphicsPixmapItem(pixmap)
scene.addItem(item)
self.graphicsView[data['friends'][i]['uin']].setScene(scene)
self.graphicsView[data['friends'][i]['uin']].resize(50,50)
示例5: createImg
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsScene [as 别名]
def createImg(self,flag,uin):
pixmap = QtGui.QPixmap()
if flag=='discuss':
url='tmp/sys/discuss.png'
elif flag=='group':
url='tmp/sys/group.jpg'
else:
url='tmp/head/'+str(uin)+'.jpg'
if not os.path.exists(url):
url='tmp/head/qq.jpg'
pixmap.load(url)
scene = QtGui.QGraphicsScene()
item = QtGui.QGraphicsPixmapItem(pixmap)
scene.addItem(item)
return scene
示例6: createImg
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsScene [as 别名]
def createImg(self,uin,flag=0,g_sender=None):
ex='head'
if flag==0:
name = str(uin)+'.jpg'
else:
if flag==1 and g_sender is None:
ex='sys'
name='group.jpg'
elif flag==2 and g_sender is None:
ex='sys'
name='discuss.png'
else:
name = str(g_sender)+'.jpg'
pixmap = QtGui.QPixmap()
if not os.path.exists('tmp/'+ex+'/' + name ):
if flag!=0:
self.main.loadFace(g_sender)
print 'load group face'
name = 'qq.jpg'
print 'pic:','tmp/',ex,'/',name
pixmap.load('tmp/'+ex+'/' + name )
scene = QtGui.QGraphicsScene()
item = QtGui.QGraphicsPixmapItem(pixmap)
scene.addItem(item)
return scene
示例7: __init__
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QGraphicsScene [as 别名]
def __init__(self, tabletName, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setFixedSize(250, 300)
self.scene = QtGui.QGraphicsScene()
self.scene.setBspTreeDepth(1)
self.view = QtGui.QGraphicsView(self.scene)
self.view.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.view.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.tabletName = tabletName
self.info = pressureInfo(self.tabletName)
splitter = QtGui.QSplitter(QtCore.Qt.Vertical)
splitter.addWidget(self.view)
splitter.addWidget(self.info)
splitter.setSizes([200, 50])
splitter.handle(0).setEnabled(False)
splitter.handle(1).setEnabled(False)
#print splitter.count()
testLayout = QtGui.QVBoxLayout()
testLayout.setAlignment(QtCore.Qt.AlignBottom)
testLayout.addWidget(splitter)
self.setLayout(testLayout)
self.blank = QtGui.QPixmap(250,250)
self.blank.fill(QtCore.Qt.white)
self.pixmap_item = QtGui.QGraphicsPixmapItem(self.blank, None, self.scene)