import sys
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QApplication
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setGeometry(300, 200, 600, 400)
self.setWindowTitle('Пример')
hbox_layout = QVBoxLayout()
red_widget = QWidget()
red_widget.setStyleSheet("background: green;")
green_widget = QWidget()
green_widget.setStyleSheet("background: green;")
hbox_layout.addWidget(red_widget)
hbox_layout.addWidget(green_widget)
self.setLayout(hbox_layout)
transparent_widget = QWidget(self)
transparent_widget.setGeometry(0, 0, 600, 400)
transparent_widget.setStyleSheet("background-color: rgba(117, 190, 218, 0.4);")
if __name__ == '__main__':
app = QApplication(sys.argv)
example = Example()
example.show()
sys.exit(app.exec_())