def make_button(self, filename, tooltip, alignment=Qt.AlignCenter):
"""
Description: Creates a QLabel which will contain an image and will
simulate a button. No associated text will be shown.
Arguments: 1. filename: The filename of the icon/image to show
2. tooltip: Some text to show as a tooltip to the image
3. alignment: Alignment of the button (center by default)
Returns: The created QLabel button
"""
global STANDARDCELLCSS, IMGDIR
filepath = '%s%s%s' % (IMGDIR, filename, '.png')
icon = QImage(filepath)
image = QLabel()
image.setToolTip('<span style="color:#B9B900">%s</span>' % (tooltip))
image.setStyleSheet(STANDARDCELLCSS)
image.setPixmap(QPixmap.fromImage(icon))
image.setAlignment(alignment)
return image
评论列表
文章目录