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


Python QtGui.QPixmap类代码示例

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


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

示例1: decoration

    def decoration(self, index):
        """Defines the decoration of the node.

        Tries to load a banner from the URL, defined by :py:meth:`banner_url`,
        sets a default image while loading and in case the attempt to
        obtain a banner was unsuccesful. If a banner has been cached for the
        given URL, the cached image will be used instead.

        :param index: The index referring to the node to get decoration for.
        :type index: :class:`~.PySide.QtCore.QModelIndex`

        :returns: The :class:`PySide.QtGui.Pixmap` to use as the node's decoration.

        """
        pixmap = QPixmap()
        banner_url = self.banner_url()
        if banner_url:
            placeholder = ":/icons/image-loading.png"
            fetch = True
        else:
            banner_url = placeholder = ":/icons/image-missing.png"
            fetch = False

        if not pixmap_cache.find(banner_url, pixmap):
            if fetch:
                banner_loader.fetch_banner(banner_url, index, self._cache)
            pixmap.load(placeholder)
            if self._scale:
                pixmap = pixmap.scaled(self._scale, Qt.AspectRatioMode.KeepAspectRatio)
            pixmap_cache.insert(banner_url, pixmap)
        return pixmap
开发者ID:toroettg,项目名称:SeriesMarker,代码行数:31,代码来源:decorated_node.py

示例2: __init__

	def __init__(self, root_node, parent=None):
		super(AddDeviceDlg, self).__init__(parent)
		self.setWindowTitle("Add Relief Device")

		id_label = QLabel("&Relief Device ID:")
		self.id_lineedit = QLineEdit()
		self.id_lineedit.setMaxLength(200)
		id_label.setBuddy(self.id_lineedit)
		area_label = QLabel("Associated Relief Device &Area:")
		self.area_combobox = QComboBox()
		for area in root_node.children:
			self.area_combobox.addItem(area.name, area)
		area_label.setBuddy(self.area_combobox)
		color_label = QLabel("&Text Color:")
		self.color_combobox = QComboBox()
		for key in sorted(COLORS.keys()):
			pixmap = QPixmap(26, 26)
			pixmap.fill(COLORS[key])
			self.color_combobox.addItem(QIcon(pixmap), key)
		color_label.setBuddy(self.color_combobox)
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
			
		layout = QGridLayout()
		layout.addWidget(id_label, 0, 0)
		layout.addWidget(self.id_lineedit, 0, 1)
		layout.addWidget(area_label, 1, 0)
		layout.addWidget(self.area_combobox, 1, 1)
		layout.addWidget(color_label, 2, 0)
		layout.addWidget(self.color_combobox, 2, 1)
		layout.addWidget(button_box, 3, 1)
		self.setLayout(layout)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
开发者ID:nb1987,项目名称:rvac,代码行数:34,代码来源:dlg_classes.py

示例3: apply

 def apply(self, value):
     if isinstance(value, basestring):
         value = QPixmap(value)
     assert isinstance(value, QPixmap), "Image bridge must be assigned a pixmap"
     if self.width and self.height:
         value = value.scaled(self.width, self.height)
     self.widget.setPixmap(value)
开发者ID:JanDeVisser,项目名称:Grumble,代码行数:7,代码来源:bridge.py

示例4: pixmap

 def pixmap(path):
     d = Resource.instance()
     f = d._pixmapPrefix + path
     p = QPixmap(f)
     if p.isNull():
         print "Pixmap not found: ", f
     return p
开发者ID:Copper-64,项目名称:Examples,代码行数:7,代码来源:dataresource.py

示例5: main

def main():
    app = QApplication(sys.argv)
    import qdarkstyle
    # setup stylesheet
    app.setStyleSheet(qdarkstyle.load_stylesheet())
    pixmap = QPixmap(os.path.join(_resourcepath('images'), "splash.png"))
    splash = QSplashScreen(pixmap, Qt.WindowStaysOnTopHint)
    splash.setMask(pixmap.mask())
    splash_font = splash.font()
    splash_font.setPixelSize(14)
    splash.setFont(splash_font)
    splash.show()
    splash.showMessage('Initialising...',
                       Qt.AlignBottom | Qt.AlignLeft |
                       Qt.AlignAbsolute,
                       Qt.white)
    app.processEvents()
    """
    for count in range(1, 6):
        splash.showMessage('Processing {0}...'.format(count),
                           Qt.AlignBottom | Qt.AlignLeft,
                           Qt.white)
        QApplication.processEvents()
        QThread.msleep(1000)
    """
    frame = ConfiguratorWindow()

    frame.show_and_raise()
    splash.finish(frame)
    sys.exit(app.exec_())
开发者ID:zenotech,项目名称:MyClusterUI,代码行数:30,代码来源:myclusterui.py

示例6: setUp

 def setUp(self):
     super(QPixmapQDatastream, self).setUp()
     self.source_pixmap = QPixmap(100, 100)
     self.source_pixmap.fill(Qt.red)
     self.output_pixmap = QPixmap()
     self.buffer = QByteArray()
     self.read_stream = QDataStream(self.buffer, QIODevice.ReadOnly)
     self.write_stream = QDataStream(self.buffer, QIODevice.WriteOnly)
开发者ID:Hasimir,项目名称:PySide,代码行数:8,代码来源:qdatastream_gui_operators_test.py

示例7: _update_cursor

 def _update_cursor(self):
     x = self.diameter
     w, h = x, x
     pixmap = QPixmap(w, h)
     pixmap.fill(Qt.transparent)
     p = QPainter(pixmap)
     p.drawPoints(self._points)
     p.end()
     self._cursor_pixmap = pixmap.createMaskFromColor(Qt.transparent)
开发者ID:jthacker,项目名称:arrview,代码行数:9,代码来源:paintbrush.py

示例8: paintEvent

 def paintEvent(self, pe):
   if self._mouse_over:
     icon = self._hover_icon
   else:
     icon = self._normal_icon
   painter = QPainter(self)
   pixmap = QPixmap(icon)
   pixmap = pixmap.scaled(self.size(), Qt.IgnoreAspectRatio)
   painter.drawPixmap(0, 0, pixmap)
开发者ID:github-account-because-they-want-it,项目名称:VisualScrape,代码行数:9,代码来源:common.py

示例9: size_changed

    def size_changed(self, value):
        "Handle the slider drag event."

        size = self.ui.brush_demo_label.size()
        pixmap = QPixmap(100, 100)
        pixmap.fill(Qt.white)
        cx, cy = int(size.width() / 2), int(size.height() / 2)
        self.current_brush.set_size(value)
        self.current_brush.draw_marker(cx, cy, pixmap, 1)
        self.ui.brush_demo_label.setPixmap(pixmap)
开发者ID:fredo-editor,项目名称:FreDo,代码行数:10,代码来源:brush_dialog.py

示例10: _wait_for_frame

 def _wait_for_frame(self):
     if self.camera.wait_for_frame(0):
         data = self.camera.image_buffer()
         bpl = self.camera.bytes_per_line
         format = QImage.Format_RGB32
         image = QImage(data, self.camera.width, self.camera.height, bpl, format)
         if self.pixmapitem is None:
             self.pixmapitem = self.scene.addPixmap(QPixmap.fromImage(image))
         else:
             self.pixmapitem.setPixmap(QPixmap.fromImage(image))
开发者ID:steveo3221,项目名称:Instrumental,代码行数:10,代码来源:gui.py

示例11: sendLocation

	def sendLocation(self, jid, latitude, longitude, rotate):
		latitude = latitude[:10]
		longitude = longitude[:10]

		self._d("Capturing preview...")
		QPixmap.grabWindow(QApplication.desktop().winId()).save(WAConstants.CACHE_PATH+"/tempimg.png", "PNG")
		img = QImage(WAConstants.CACHE_PATH+"/tempimg.png")

		if rotate == "true":
			rot = QTransform()
			rot = rot.rotate(90)
			img = img.transformed(rot)

		if img.height() > img.width():
			result = img.scaledToWidth(320,Qt.SmoothTransformation);
			result = result.copy(result.width()/2-50,result.height()/2-50,100,100);
		elif img.height() < img.width():
			result = img.scaledToHeight(320,Qt.SmoothTransformation);
			result = result.copy(result.width()/2-50,result.height()/2-50,100,100);
		#result = img.scaled(96, 96, Qt.KeepAspectRatioByExpanding, Qt.SmoothTransformation);

		result.save( WAConstants.CACHE_PATH+"/tempimg2.jpg", "JPG" );

		f = open(WAConstants.CACHE_PATH+"/tempimg2.jpg", 'r')
		stream = base64.b64encode(f.read())
		f.close()


		os.remove(WAConstants.CACHE_PATH+"/tempimg.png")
		os.remove(WAConstants.CACHE_PATH+"/tempimg2.jpg")

		fmsg = WAXMPP.message_store.createMessage(jid);
		
		mediaItem = WAXMPP.message_store.store.Media.create()
		mediaItem.mediatype_id = WAConstants.MEDIA_TYPE_LOCATION
		mediaItem.remote_url = None
		mediaItem.preview = stream
		mediaItem.local_path ="%s,%s"%(latitude,longitude)
		mediaItem.transfer_status = 2

		fmsg.content = QtCore.QCoreApplication.translate("WAEventHandler", "Location")
		fmsg.Media = mediaItem

		if fmsg.Conversation.type == "group":
			contact = WAXMPP.message_store.store.Contact.getOrCreateContactByJid(self.conn.jid)
			fmsg.setContact(contact);
		
		fmsg.setData({"status":0,"content":fmsg.content,"type":1})
		WAXMPP.message_store.pushMessage(jid,fmsg)
		
		
		resultId = self.interfaceHandler.call("message_locationSend", (jid, latitude, longitude, stream))
		k = Key(jid, True, resultId)
		fmsg.key = k.toString()
		fmsg.save()
开发者ID:timofonic,项目名称:wazapp,代码行数:55,代码来源:waxmpp.py

示例12: x_bitmap_opaque

    def x_bitmap_opaque ( self, bitmap ):
        """ Returns a version of the specified bitmap with no transparency.
        """
        dx = bitmap.width()
        dy = bitmap.height()
        opaque_bitmap = QPixmap( dx, dy )
        opaque_bitmap.fill( WindowColor )
        q = QPainter( opaque_bitmap )
        q.drawPixmap( 0, 0, bitmap )

        return opaque_bitmap
开发者ID:davidmorrill,项目名称:facets,代码行数:11,代码来源:image_slice.py

示例13: grabImg

	def grabImg(self):
		self.idFrame += 1	
		wid = QApplication.desktop().winId()
		QPixmap.grabWindow(wid, self.screenArea.x, self.screenArea.y, self.screenArea.w, self.screenArea.h).save(self.buffer, 'png')
		strio = StringIO.StringIO()
		strio.write(self.buffer.data())
		self.buffer.seek(0)
		strio.seek(0)
		pix = np.array(Image.open(strio))
		pix = cv2.resize(pix, (0,0), fx=self.scale, fy=self.scale)
		real_color = cv2.cvtColor(pix, cv2.COLOR_BGR2RGB)
		return real_color
开发者ID:guyver2,项目名称:SFA2YT,代码行数:12,代码来源:Player.py

示例14: choose_color

def choose_color():
    color  = QColorDialog().getColor()
    
    msgbox = QMessageBox()
    if color.isValid():
        pixmap = QPixmap(50, 50)
        pixmap.fill(color)
        msgbox.setWindowTitle(u'Selected Color')
        msgbox.setIconPixmap(pixmap)
    else:
        msgbox.setWindowTitle(u'No Color was Selected')
    msgbox.exec_()
开发者ID:eueung,项目名称:python,代码行数:12,代码来源:app5.py

示例15: Ant

class Ant():
    def __init__(self, name):
        self.picture = QPixmap()
        self.motion = AntMotion()
        self.name = name
        self.zombie = False

    def width(self):
        return self.picture.width()

    def height(self):
        return self.picture.height()
开发者ID:akhtyamovpavel,项目名称:mr-ant,代码行数:12,代码来源:ant.py


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