def toggleCursor(self): if self.cursor().shape() == QCursor(Qt.ArrowCursor).shape(): raw = QPixmap(":/gui/pics/pardusman-icon.png") raw.setMask(raw.mask()) self.setCursor(QCursor(raw, 2, 2)) else: self.unsetCursor()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from PyQt5.Qt import QApplication, QPixmap, QLabel app = QApplication([]) pix = QPixmap("pipe.png") win = QLabel() win.setPixmap(pix) win.setMask(pix.mask()) win.show() app.exec()
widget.move(pos) if __name__ == '__main__': app = QApplication(sys.argv) lifetime_ms = 3000 if len(sys.argv) == 2: lifetime_ms = int(sys.argv[1]) pix = QPixmap(FILE_NAME) mw = QLabel() mw.setWindowFlag(Qt.WindowStaysOnTopHint) mw.setWindowFlag(Qt.FramelessWindowHint) mw.setPixmap(pix) mw.setMask(pix.mask()) mw.show() move_window_to_cursor(mw) timer = QTimer() timer.timeout.connect(lambda: move_window_to_cursor(mw)) timer.start(33) QTimer.singleShot(lifetime_ms, app.quit) app.exec()