當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QPixmap方法代碼示例

本文整理匯總了Python中PySide2.QtGui.QPixmap方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QPixmap方法的具體用法?Python QtGui.QPixmap怎麽用?Python QtGui.QPixmap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PySide2.QtGui的用法示例。


在下文中一共展示了QtGui.QPixmap方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load_icon

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def load_icon(fname_icon):
	path_this_file = os.path.abspath(__file__)
	path_this_dir = os.path.dirname(path_this_file)
	path_icons = os.path.join(path_this_dir, '..', 'media', 'icons')
	path_icon = os.path.join(path_icons, fname_icon)

	pixmap = QtGui.QPixmap(path_icon)

	#pixmap.fill(QtGui.QColor('red'))
	#pixmap.setMask(pixmap.createMaskFromColor(QtGui.QColor('black'), QtGui.Qt.MaskOutColor))

	icon = QtGui.QIcon()
	icon.addPixmap(pixmap, QtGui.QIcon.Normal)
	icon.addPixmap(pixmap, QtGui.QIcon.Disabled)

	return icon 
開發者ID:Vector35,項目名稱:debugger,代碼行數:18,代碼來源:ControlsWidget.py

示例2: build_spore_ui

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def build_spore_ui(self):

        self.item_wdg.setFrameStyle(QFrame.Raised | QFrame.StyledPanel)
        self.setStyleSheet("background-color: rgb(68,68,68);")

        pixmap = QPixmap(':/out_particle.png')
        icon_lbl = QLabel()
        icon_lbl.setMaximumWidth(18)
        icon_lbl.setPixmap(pixmap)
        self.item_lay.addWidget(icon_lbl, 0, 1, 1, 1)

        self.target_lbl = QLabel(self.name)
        self.item_lay.addWidget(self.target_lbl, 0, 2, 1, 1)

        self.target_edt = QLineEdit(self.item_wdg)
        self.target_edt.setStyleSheet("background-color: rgb(68,68,68);")
        self.target_edt.setMinimumWidth(180)
        self.target_edt.setVisible(False)
        self.item_lay.addWidget(self.target_edt, 0, 2, 1, 1)

        self.item_lay.setColumnStretch(2, 1)

        self.view_buttons = DisplayButtons(self)
        self.item_lay.addWidget(self.view_buttons, 0, 3, 1, 1) 
開發者ID:wiremas,項目名稱:spore,代碼行數:26,代碼來源:manager_ui.py

示例3: data

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def data(self, index, role):
        """
        This function partly overrides the standard QFileSystemModel data
        function to return custom file and folder icons
        """

        fileInfo = self.getFileInfo(index)[4]

        if role == QtCore.Qt.DecorationRole:
            if fileInfo.isDir():
                return QtGui.QPixmap(ICONS_L + 'Folder.png')
            elif fileInfo.isFile():
                return QtGui.QPixmap(ICONS_L + 'airfoil.png')

        # return QtWidgets.QFileSystemModel.data(self, index, role)
        return super().data(index, role)

    # @QtCore.Slot(QtCore.QModelIndex) 
開發者ID:chiefenne,項目名稱:PyAero,代碼行數:20,代碼來源:FileSystem.py

示例4: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version="0.1"
        self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__
            
        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:26,代碼來源:universal_tool_template_0903.py

示例5: _get_application_icon

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def _get_application_icon() -> QIcon:
        """
        This finds the running blender process, extracts the blender icon from the blender.exe file on disk and saves it to the user's temp folder.
        It then creates a QIcon with that data and returns it.

        Returns QIcon: Application Icon
        """

        icon_filepath = Path(__file__).parent / ".." / "blender_icon_16.png"
        icon = QIcon()

        if icon_filepath.exists():
            image = QImage(str(icon_filepath))
            if not image.isNull():
                icon = QIcon(QPixmap().fromImage(image))

        return icon 
開發者ID:techartorg,項目名稱:bqt,代碼行數:19,代碼來源:blender_application.py

示例6: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def __init__(self):
        super(_HomeTab, self).__init__()

        self._layout = QHBoxLayout()
        self.setLayout(self._layout)

        message_label = QLabel("""\
        Welcome to <b>EvilOSX</b>:<br/>
        An evil RAT (Remote Administration Tool) for macOS / OS X.<br/><br/><br/>

        Author: Marten4n6<br/>
        License: GPLv3<br/>
        Version: <b>{}</b>
        """.format(VERSION))
        logo_label = QLabel()

        logo_path = path.join(path.dirname(__file__), path.pardir, path.pardir, "data", "images", "logo_334x600.png")
        logo_label.setPixmap(QPixmap(logo_path))

        self._layout.setAlignment(Qt.AlignCenter)
        self._layout.setSpacing(50)
        self._layout.addWidget(message_label)
        self._layout.addWidget(logo_label) 
開發者ID:Marten4n6,項目名稱:EvilOSX,代碼行數:25,代碼來源:gui.py

示例7: done

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def done(self):
        logger.info("Finished")
        donepixmap = QtGui.QPixmap(":/newPrefix/images/Check-icon.png")
        self.lbl_clean_pic.setPixmap(donepixmap)
        self.statusbar.showMessage("Ready")
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(100)
        self.progressBar.setValue(100)
        self.lbl_task.setText("Finished")
        self.btn_Quit.setEnabled(True)
        self.btn_Check.setEnabled(True)
        self.btn_execute.show()
        opsys = platform.system()
        if opsys == "Windows":
            self.btn_execute.clicked.connect(self.exec_windows)
        if opsys.lower == "darwin":
            self.btn_execute.clicked.connect(self.exec_osx)
        if opsys == "Linux":
            self.btn_execute.clicked.connect(self.exec_linux) 
開發者ID:overmindstudios,項目名稱:BlenderUpdater,代碼行數:21,代碼來源:BlenderUpdater.py

示例8: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def __init__(self, image = QtGui.QImage(), x = 0, y = 0, width = 0, height = 0):
		super(BitmapData, self).__init__()

		if isinstance(image, QtGui.QImage):
			if stage.app:
				image = QtGui.QPixmap(image)
		elif not isinstance(image, QtGui.QPixmap):
			raise TypeError("BitmapData(image = QtGui.QImage(), x = 0, y = 0, width = 0, height = 0): parameter 'image' must be a QPixmap or QImage object.")

		self.image = image
		self.x = x
		self.y = y
		self.width = width
		self.height = height
		self.__locked = False
		self.__pixelData = []

		if image is not None:
			if width == 0:
				self.width = image.width()

			if height == 0:
				self.height = image.height() 
開發者ID:yuehaowang,項目名稱:pylash_engine,代碼行數:25,代碼來源:display.py

示例9: draw

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def draw(self, source):
		if not isinstance(source, DisplayObject):
			raise TypeError("BitmapData.draw(source): parameter 'source' must be a display object.")

		w = source.endX()
		h = source.endY()

		self.image = QtGui.QPixmap(w, h)
		self.image.fill(QtCore.Qt.transparent)
		
		p = QtGui.QPainter()
		p.begin(self.image)

		if stage.useAntialiasing:
			p.setRenderHint(QtGui.QPainter.Antialiasing, True)
		else:
			p.setRenderHint(QtGui.QPainter.Antialiasing, False)

		source._show(p)

		p.end()

		self.width = w
		self.height = h 
開發者ID:yuehaowang,項目名稱:pylash_engine,代碼行數:26,代碼來源:display.py

示例10: __updatePixelData

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def __updatePixelData(self):
		x = 0
		y = 0

		for i in range(len(self.__pixelData)):
			v = self.__pixelData[i]

			self.image.setPixel(x, y, v)

			x += 1

			if x >= self.width:
				x = 0
				y += 1

		self.image = QtGui.QPixmap(self.image)

		self.__pixelData = [] 
開發者ID:yuehaowang,項目名稱:pylash_engine,代碼行數:20,代碼來源:display.py

示例11: build_ui

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def build_ui(self):
        layout = QGridLayout(self)
        layout.setContentsMargins(5, 5, 5, 5)
        self.setLayout(layout)

        self.name_edt = QLineEdit()
        self.name_edt.setPlaceholderText('Create New')
        self.name_edt.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        layout.addWidget(self.name_edt, 0, 0, 1, 1)

        self.add_btn = QPushButton()
        self.add_btn.setIcon(QIcon(QPixmap(':/teAdditive.png')))
        self.add_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)
        layout.addWidget(self.add_btn, 0, 1, 1, 1)

        self.refresh_btn = QPushButton()
        self.refresh_btn.setIcon(QIcon(QPixmap(':/teKeyRefresh.png')))
        self.refresh_btn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Preferred)
        layout.addWidget(self.refresh_btn, 0, 2, 1, 1)

        scroll_wdg = QWidget(self)
        scroll_area = QScrollArea()
        scroll_area.setWidgetResizable(True)
        scroll_area.setStyleSheet("QScrollArea { background-color: rgb(57,57,57);}");
        scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
        scroll_area.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        scroll_area.setWidget(scroll_wdg)

        self.spore_layout = QVBoxLayout()
        self.spore_layout.setContentsMargins(1, 1, 3, 1)
        self.spore_layout.setSpacing(0)
        self.spore_layout.addStretch()
        scroll_wdg.setLayout(self.spore_layout)
        layout.addWidget(scroll_area, 1, 0, 1, 3)

        #  self.frame_lay.addWidget(ItemWidget())
        #  layout.addWidget(btn, 0, 0, 1, 1) 
開發者ID:wiremas,項目名稱:spore,代碼行數:39,代碼來源:manager_ui.py

示例12: build_geo_ui

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def build_geo_ui(self):

        #  self.setMaximumHeight(85)
        self.item_wdg.setFrameStyle(QFrame.Raised | QFrame.StyledPanel)
        self.item_wdg.setStyleSheet("QFrame { background-color: rgb(55,55,55);}")

        icon = QIcon()
        icon.addPixmap(QPixmap(':/nudgeDown.png'), QIcon.Normal, QIcon.On);
        icon.addPixmap(QPixmap(':/nudgeRight.png'), QIcon.Normal, QIcon.Off);
        self.expand_btn = QPushButton()
        self.expand_btn.setStyleSheet("QPushButton#expand_btn:checked {background-color: green; border: none}")
        self.expand_btn.setStyleSheet("QPushButton { color:white; }\
                                        QPushButton:checked { background-color: rgb(55,55, 55); border: none; }\
                                        QPushButton:pressed { background-color: rgb(55,55, 55); border: none; }") #\
                                        #  QPushButton:hover{ background-color: grey; border-style: outset; }")
        self.expand_btn.setFlat(True)
        self.expand_btn.setIcon(icon)
        self.expand_btn.setCheckable(True)
        self.expand_btn.setChecked(True)
        self.expand_btn.setFixedWidth(25)
        self.expand_btn.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
        self.item_lay.addWidget(self.expand_btn, 0, 0, 1, 1)

        pixmap = QPixmap(':/pickGeometryObj.png')
        icon_lbl = QLabel()
        icon_lbl.setMaximumWidth(18)
        icon_lbl.setPixmap(pixmap)
        self.item_lay.addWidget(icon_lbl, 0, 1, 1, 1)

        self.target_lbl = QLabel(self.name)
        self.item_lay.addWidget(self.target_lbl, 0, 2, 1, 1)
        #  self.target_edt = QLineEdit(item_wdg)
        #  self.target_edt.setMinimumWidth(180)
        #  self.target_edt.setVisible(False)

        self.item_lay.setColumnStretch(3, 1)

        #  self.view_buttons = DisplayButtons(self)
        #  self.item_lay.addWidget(self.view_buttons, 0, 4, 1, 1) 
開發者ID:wiremas,項目名稱:spore,代碼行數:41,代碼來源:manager_ui.py

示例13: synchronize_image

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def synchronize_image(self):
        self.pixmap = QtGui.QPixmap(self.options['image.path'])
        if self.options['image.fit'] is True:
            self.image_rect = None
            return
        self.image_rect = QtCore.QRect(
            self.rect.left(),
            self.rect.top(),
            self.options['image.width'],
            self.options['image.height'])
        self.image_rect.moveCenter(self.rect.center().toPoint()) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:13,代碼來源:interactive.py

示例14: _addAccountToWindow

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def _addAccountToWindow(self, account, balance, resize_parent=False):
        wrapper_layout = QVBoxLayout()
        account_layout = QHBoxLayout()
        rows_layout = QVBoxLayout()
        address_layout = QHBoxLayout()
        account_label = QLabel(account)
        account_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        copy_button = QPushButton()
        copy_button.setAutoFillBackground(True)
        copy_button.setIcon(QIcon('icons/copy.svg'))
        self.connect(copy_button, SIGNAL('clicked()'), lambda: self.copyAddress(account))
        address_layout.addWidget(account_label)
        address_layout.addWidget(copy_button)
        balance_label = QLabel('Balance: %.5f ethers' % balance)
        balance_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        self.balance_widgets[account] = balance_label
        rows_layout.addLayout(address_layout)
        rows_layout.addWidget(balance_label)
        avatar = QLabel()
        img_filename = render_avatar(account)
        pixmap = QPixmap(img_filename)
        avatar.setPixmap(pixmap)
        account_layout.addWidget(avatar)
        account_layout.addLayout(rows_layout)
        wrapper_layout.addLayout(account_layout)
        wrapper_layout.addSpacing(20)
        self.accounts_layout.addLayout(wrapper_layout)

        if resize_parent:
            sizeHint = self.sizeHint()
            self.parentWidget().parentWidget().resize(QSize(sizeHint.width(), sizeHint.height() + 40)) 
開發者ID:PacktPublishing,項目名稱:Hands-On-Blockchain-for-Python-Developers,代碼行數:33,代碼來源:account_widget.py

示例15: setAvatar

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QPixmap [as 別名]
def setAvatar(self, code, avatar):
        img_filename = render_avatar(code)
        pixmap = QPixmap(img_filename)
        avatar.setPixmap(pixmap) 
開發者ID:PacktPublishing,項目名稱:Hands-On-Blockchain-for-Python-Developers,代碼行數:6,代碼來源:send_widget.py


注:本文中的PySide2.QtGui.QPixmap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。