datetime:2019/5/20 17:13
author:nzb
无边框窗口
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QLabel, QGroupBox, QCheckBox, QHBoxLayout, QPushButton, QButtonGroup, \
QSizeGrip
from PyQt5.QtWidgets import QVBoxLayout, QRadioButton
from PyQt5 import QtGui, QtCore
class UI_demo(QWidget):
"""用户界面"""
def __init__(self):
super().__init__()
self.title = 'PyQt5 Frameless Window'
self.left = 600
self.top = 200
self.width = 500
self.height = 200
self.iconName = '../img/home.ico'
self.initWindow()
def initWindow(self):
self.setWindowIcon(QtGui.QIcon(self.iconName))
self.setGeometry(self.left, self.top, self.width, self.height)
self.setWindowTitle(self.title)
flags = QtCore.Qt.WindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
self.setWindowFlags(flags)
vbox = QVBoxLayout()
sizegrip = QSizeGrip(self)
vbox.addWidget(sizegrip)
self.setLayout(vbox)
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
ex = UI_demo()
sys.exit(app.exec_())