本文整理汇总了Python中PyQt5.QtGui.QPixmap方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPixmap方法的具体用法?Python QtGui.QPixmap怎么用?Python QtGui.QPixmap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QPixmap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tray_icon
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def get_tray_icon(self):
base64_data = '''iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHN
CSVQICAgIfAhkiAAAAQNJREFUOI3t1M9KAlEcxfHPmP0xU6Ogo
G0teoCiHjAIfIOIepvKRUE9R0G0KNApfy0c8hqKKUMrD9zVGc4
9nPtlsgp5n6qSVSk7cBG8CJ6sEX63UEcXz4jE20YNPbygPy25Q
o6oE+fEPXFF7A5yA9Eg2sQDcU3sJd6k89O4iiMcYKVol3rH2Mc
a1meZ4hMdNPCIj+SjHHfFZU94/0Nwlv4rWoY7vhrdeLNoO86bG
lym/ge3lsHDdI2fojbBG6sUtzOiQ1wQOwk6GwWKHeJyHtxOcFi
0TpFaxmnhNcyIW45bQ6RS3Hq4MeB7Ltyahki9Gd2xidWiwG9va
nCZqi7xlZGVHfwN6+5nU/ccBUYAAAAASUVORK5CYII='''
pm = Qg.QPixmap()
pm.loadFromData(base64.b64decode(base64_data))
i = Qg.QIcon()
i.addPixmap(pm)
return i
# OFF BY DEFAULT
# 0.2 SEC DELAY TO LET USER FINISH TYPING BEFORE INPUT BECOMES A DB QUERY
示例2: draw
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def draw(self, refresh=False):
if self.dataModel.getOffset() in self.Paints:
self.refresh = False
self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
self.drawAdditionals()
return
if self.refresh or refresh:
qp = QtGui.QPainter()
qp.begin(self.qpix)
self.drawTextMode(qp)
self.refresh = False
qp.end()
# self.Paints[self.dataModel.getOffset()] = QtGui.QPixmap(self.qpix)
self.drawAdditionals()
示例3: draw
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def draw(self, refresh=False):
if self.dataModel.getOffset() in self.Paints:
self.refresh = False
self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
self.drawAdditionals()
return
if self.refresh or refresh:
qp = QtGui.QPainter()
qp.begin(self.qpix)
self.drawTextMode(qp)
self.refresh = False
qp.end()
self.drawAdditionals()
示例4: draw
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def draw(self, refresh=False, row=0, howMany=0):
if self.dataModel.getOffset() in self.Paints:
self.refresh = False
self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
self.drawAdditionals()
return
if self.refresh or refresh:
qp = QtGui.QPainter()
qp.begin(self.qpix)
start = time()
if not howMany:
howMany = self.ROWS
self.drawTextMode(qp, row=row, howMany=howMany)
end = time() - start
log.debug('draw Time ' + str(end))
self.refresh = False
qp.end()
# self.Paints[self.dataModel.getOffset()] = QtGui.QPixmap(self.qpix)
self.drawAdditionals()
示例5: setWaveform
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def setWaveform(self, waveform):
if waveform and waveform.error:
self.setForeground(self.errorForeground)
else:
self.setForeground(self.defaultForeground)
if waveform:
if waveform.loading or waveform.error or not waveform.image_exists:
self.imagePath = None
self.setData(QtCore.Qt.DecorationRole, None)
if waveform.loading:
self.setText('Loading waveform data...')
elif waveform.error:
self.setText(waveform.error)
else:
self.setText('')
else:
if waveform.image_path != self.imagePath:
self.imagePath = waveform.image_path
pic = QtGui.QPixmap(waveform.image_path)
self.setData(QtCore.Qt.DecorationRole, pic)
self.setText('')
else:
self.imagePath = None
self.setText('')
示例6: set_status
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def set_status(self, raw, exist=None):
item = QLabel()
item.setAlignment(Qt.AlignCenter)
if exist is 0:
icon = QPixmap(QUEUE_ICON).scaled(20, 20, Qt.KeepAspectRatio,
Qt.SmoothTransformation)
item.setPixmap(icon)
item.setToolTip('Waiting in the download queue...')
if exist is 1:
icon = QPixmap(CHECK_ICON).scaled(20, 20, Qt.KeepAspectRatio,
Qt.SmoothTransformation)
item.setPixmap(icon)
item.setToolTip('All the features are downloaded...')
if exist is 2:
item = QPushButton(self)
item.setToolTip('Download')
item.setIcon(QIcon(DOWNLOAD_ICON))
item.clicked.connect(self.download_clicked)
self.setCellWidget(raw, 0, item)
示例7: drawBackground
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def drawBackground(self, pixmap):
"""Draw background in pixmap.
"""
w, h = pixmap.width(), pixmap.height()
mode = self.__bgModes[self.bgCBox.currentIndex()]
source = QPixmap(pixmap)
painter = QtGui.QPainter(pixmap)
if mode == self.BG_COLOR:
painter.fillRect(0, 0, w, h, self.bgColor)
if mode == self.BG_TRANSPARENT or mode == self.BG_IMAGE or mode == self.BG_INPUT:
painter.drawPixmap(0, 0, common.checkerboard(pixmap.size()))
if mode == self.BG_IMAGE and self.bgPath:
bgPixmap = QPixmap(self.bgPath)
if not bgPixmap.isNull():
bgPixmap = bgPixmap.scaled(w, h, QtCore.Qt.IgnoreAspectRatio)
painter.drawPixmap(0, 0, bgPixmap)
if mode == self.BG_INPUT:
painter.drawPixmap(0, 0, source)
示例8: get_pixel
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def get_pixel(point):
global w, point_zat, circle
pix = QPixmap()
if circle:
r = w.rad.value()
draw_circle(w.image, r, point)
circle = False
if point_zat:
w.p_x.setValue(point.x())
w.p_y.setValue(point.y())
draw_edges(w.image, w.edges)
point_zat = False
pix.convertFromImage(w.image)
w.scene.addPixmap(pix)
w.lock.setDisabled(False)
w.erase.setDisabled(False)
w.paint.setDisabled(False)
w.addpoint.setDisabled(False)
w.addcircle.setDisabled(False)
w.pixel.setDisabled(False)
示例9: draw
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def draw(self, refresh=False):
if self.dataModel.getOffset() in self.Paints:
self.refresh = False
self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
#print 'hit'
self.drawAdditionals()
return
if self.refresh or refresh:
qp = QtGui.QPainter()
qp.begin(self.qpix)
# viewport
#qp.fillRect(0, 0, self.COLUMNS * self.fontWidth, self.ROWS * self.fontHeight, self.backgroundBrush)
#start = time()
self.drawTextMode(qp)
#end = time() - start
#print 'Time ' + str(end)
self.refresh = False
qp.end()
# self.Paints[self.dataModel.getOffset()] = QtGui.QPixmap(self.qpix)
self.drawAdditionals()
示例10: draw
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def draw(self, refresh=False, row=0, howMany=0):
if self.dataModel.getOffset() in self.Paints:
self.refresh = False
self.qpix = QtGui.QPixmap(self.Paints[self.dataModel.getOffset()])
#print 'hit'
self.drawAdditionals()
return
if self.refresh or refresh:
qp = QtGui.QPainter()
qp.begin(self.qpix)
#start = time()
if not howMany:
howMany = self.ROWS
self.drawTextMode(qp, row=row, howMany=howMany)
#end = time() - start
#print 'Time ' + str(end)
self.refresh = False
qp.end()
# self.Paints[self.dataModel.getOffset()] = QtGui.QPixmap(self.qpix)
self.drawAdditionals()
示例11: setupUi
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def setupUi(self):
ui_about_dlg.Ui_AboutDlg.setupUi(self, self)
self.setWindowTitle("About")
img = QPixmap(os.path.join(self.app_config.app_dir, "img/dmt.png"))
img = img.scaled(QSize(64, 64))
self.lblImage.setPixmap(img)
self.lblAppName.setText('Dash Masternode Tool ' + self.app_version_str)
self.textAbout.setOpenExternalLinks(True)
self.textAbout.viewport().setAutoFillBackground(False)
if sys.platform == 'win32':
self.resize(600, 310)
self.textAbout.setHtml(self.textAbout.toHtml().replace('font-size:11pt', 'font-size:10pt'))
self.textAbout.setHtml(self.textAbout.toHtml().replace('font-size:9pt', 'font-size:8pt'))
elif sys.platform == 'darwin':
self.textAbout.setHtml(self.textAbout.toHtml().replace('font-size:11pt', 'font-size:13pt'))
elif sys.platform == 'linux':
self.resize(620, 320)
# self.layout().setSizeConstraint(QLayout.SetFixedSize)
示例12: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def __init__(self):
super().__init__()
self._scale = 0.7
self._version_y_offset = 0 # when extra visual elements are in the background image, move version text down
if ApplicationMetadata.IsEnterpriseVersion:
splash_image = QPixmap(Resources.getPath(Resources.Images, "cura_enterprise.png"))
self._version_y_offset = 26
else:
splash_image = QPixmap(Resources.getPath(Resources.Images, "cura.png"))
self.setPixmap(splash_image)
self._current_message = ""
self._loading_image_rotation_angle = 0
self._to_stop = False
self._change_timer = QTimer()
self._change_timer.setInterval(50)
self._change_timer.setSingleShot(False)
self._change_timer.timeout.connect(self.updateLoadingImage)
self._last_update_time = None
示例13: _build_pixmap
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def _build_pixmap(self, input):
if isinstance(self.bgimage, bytes):
pixmap = QtGui.QPixmap()
pixmap.loadFromData(self.bgimage)
else:
pixmap = QtGui.QPixmap(self.bgimage)
return pixmap
示例14: OnCreate
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def OnCreate(self, _):
self.setupUi(self)
self.binsec_connect_button.clicked.connect(self.connect_binsec)
self.dba_decode_button.clicked.connect(self.decode_button_clicked)
self.here_decode_button.clicked.connect(self.decode_here_clicked)
self.pinsec_ip_field.setText("192.168.56.101")
self.pinsec_port_field.setText("5555")
self.binsec_port_field.setValidator(QtGui.QIntValidator(0, 65535))
self.pinsec_port_field.setValidator(QtGui.QIntValidator(0, 65535))
self.ok = QtGui.QPixmap(":/icons/icons/oxygen/22x22/ok.png")
self.ko = QtGui.QPixmap(":/icons/icons/oxygen/22x22/ko.png")
self.prev_modules = sys.modules.keys()
self.set_pinsec_visible(False)
示例15: _getNewPixmap
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPixmap [as 别名]
def _getNewPixmap(self, width, height):
return QtGui.QPixmap(width, height)