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