| 23 | |
| 24 | |
| 25 | class Label(QLabel): |
| 26 | |
| 27 | def __init__(self, *args, **kwargs): |
| 28 | super(Label, self).__init__(*args, **kwargs) |
| 29 | # .9 格式的图片 |
| 30 | self.image = QImage('Data/skin_aio_friend_bubble_pressed.9.png') |
| 31 | |
| 32 | def showEvent(self, event): |
| 33 | super(Label, self).showEvent(event) |
| 34 | pixmap = QtNinePatch2.createPixmapFromNinePatchImage( |
| 35 | self.image, self.width(), self.height()) |
| 36 | self.setPixmap(pixmap) |
| 37 | |
| 38 | def resizeEvent(self, event): |
| 39 | super(Label, self).resizeEvent(event) |
| 40 | pixmap = QtNinePatch2.createPixmapFromNinePatchImage( |
| 41 | self.image, self.width(), self.height()) |
| 42 | self.setPixmap(pixmap) |
| 43 | |
| 44 | |
| 45 | app = QApplication(sys.argv) |