本文整理汇总了Python中PySide.QtGui.QPixmap.mask方法的典型用法代码示例。如果您正苦于以下问题:Python QPixmap.mask方法的具体用法?Python QPixmap.mask怎么用?Python QPixmap.mask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QPixmap
的用法示例。
在下文中一共展示了QPixmap.mask方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import mask [as 别名]
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_())
示例2: _put
# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import mask [as 别名]
def _put(self, res):
"""Put resource on widget"""
label = QLabel()
if "image" in res.mime:
pixmap = QPixmap(res.file_path).scaledToWidth(100)
label.setPixmap(pixmap)
label.setMask(pixmap.mask())
else:
label.setText(res.file_name)
label.mouseReleaseEvent = partial(self.click, res)
self.widget.widget().layout().addWidget(label)
self.widget.show()
self._resource_labels[res] = label
self._res_hash[res.hash] = res
res.in_content = False
示例3: start
# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import mask [as 别名]
def start(self):
configs = {}
configs['n'] = int(self.leSelectionSize.text())
configs['dimX1'] = int(self.leSizeX1.text())
configs['dimX2'] = int(self.leSizeX2.text())
configs['dimX3'] = int(self.leSizeX3.text())
configs['dimY'] = int(self.leSizeY.text())
configs['polynomType'] = self.cbPolynomType.currentIndex()
configs['startdegX1'] = 0
configs['startdegX2'] = 0
configs['startdegX3'] = 0
configs['enddegX1'] = int(self.lePowerX1.text())
configs['enddegX2'] = int(self.lePowerX2.text())
configs['enddegX3'] = int(self.lePowerX3.text())
configs['weight'] = self.cbWeight.currentIndex()
configs['lambda'] = self.cbThreeLambda.isChecked()
configs['findBest'] = False
configs['inputFile'] = self.leInputFile.text()
solve.compute(configs)
graphs = {
'Y' : 'y_all',
'X1' : 'x1_all',
'X2' : 'x2_all',
'X3' : 'x3_all',
'Error1' : 'err_1',
'Error1Norm' : 'err_1norm',
'Error2' : 'err_2',
'Error2Norm' : 'err_2norm',
'Y1' : 'y_1',
'Y1Norm' : 'y_1norm',
'Y2' : 'y_2',
'Y2Norm' : 'y_2norm',
}
for (k,v) in graphs.items():
graph = QPixmap('img_' + v + '.png')
self.__getattribute__('lGraph' + k)
self.__getattribute__('lGraph' + k).setPixmap(graph);
self.__getattribute__('lGraph' + k).setMask(graph.mask());
results = open('results.txt').read()
self.tOutput.setPlainText(results)
示例4: __init__
# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import mask [as 别名]
def __init__(self, res):
QWidget.__init__(self)
self.res = res
layout = QVBoxLayout()
self.setLayout(layout)
preview = QLabel()
if 'image' in res.mime:
pixmap = QPixmap(res.file_path).scaledToWidth(32)
else:
info = QFileInfo(res.file_path)
pixmap = QFileIconProvider().icon(info).pixmap(32, 32)
preview.setPixmap(pixmap)
preview.setMask(pixmap.mask())
preview.setMaximumHeight(32)
label = QLabel()
label.setText(res.file_name)
layout.addWidget(preview)
layout.addWidget(label)
layout.setAlignment(Qt.AlignHCenter)
self.setFixedWidth(64)
self.setFixedHeight(64)