Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt5 import QtWidgets, QtCore
- app = QtWidgets.QApplication([]) # or sys.argv
- win = QtWidgets.QWidget()
- # transparent window but with frame/border
- win.setAttribute(QtCore.Qt.WA_TranslucentBackground)
- # remove frame/border
- win.setWindowFlags(QtCore.Qt.FramelessWindowHint)
- button = QtWidgets.QPushButton("HELLO", win)
- button.setGeometry(50, 50, 50, 50)
- button.clicked.connect(win.close)
- # partially transparent button
- button.setStyleSheet("QWidget {background-color: rgba(50,50,50,128)}")
- #win.setWindowOpacity(0.5)
- win.show()
- app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement