本文整理汇总了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
示例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)
示例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)
示例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)
示例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
示例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)
示例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)
示例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()
示例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
示例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 = []
示例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)
示例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)
示例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())
示例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))
示例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)