import sys
from PyQt5.QtWidgets import QWidget, QApplication, QDesktopWidget, QLabel
from PyQt5.QtGui import QCursor,QFont
from PyQt5.QtCore import Qt, QTimer
class Example(QWidget):
__dragWin = False
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowFlags(Qt.WindowStaysOnTopHint)
# pyqt5设置窗体透明控件不透明
self.setAttribute(Qt.WA_TranslucentBackground)
self.setWindowFlags(Qt.FramelessWindowHint | Qt.Tool)
self.pic_lbl = QLabel("5", self)
self.pic_lbl.setStyleSheet("QLabel{font-size:200px; color:#f0f;}")
self.pic_lbl.setFont(QFont("Microsoft YaHei"))
self.pic_lbl.setAlignment(Qt.AlignCenter)
# pic_lbl.setPixmap(QPixmap("bg2.png"))
# self.setWindowOpacity(.5)
self.timer = QTimer()
self.timer.setIn