Window without PyQt5 frames via QtDesigner

Creating a form via QtDesigner from the PySide library. I save the form as *.ui файл, then run this file through pyside-uic to get the *.py file.

I need to show the user the window без тайтла и стандартных рамок винды (I want to make my own interface)

No matter how many times I Googled, I only find

setWindowFlags(Qt.FramelessWindowHint)

Accordingly, this is the only correct solution to this problem,

But where exactly to put this flag in the design file is not clear, it is not described anywhere. Sorry for my stupidity in this issue may just need a fresh look from the outside.

Where exactly to insert the flag assignment "Qt. FramelessWindowHint"?

It looks like this:

from PySide import QtCore, QtGui

class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.pushButton = QtGui.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(170, 190, 75, 23))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtGui.QPushButton(Form)
        self.pushButton_2.setGeometry(QtCore.QRect(170, 230, 75, 23))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label = QtGui.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(180, 130, 46, 13))
        self.label.setObjectName("label")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton.setText(QtGui.QApplication.translate("Form", "Hello world", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton_2.setText(QtGui.QApplication.translate("Form", "GoodBye", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("Form", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
Author: S. Nick, 2020-01-06

2 answers

Never modify a module created in QtDesigner !

You should think of this module as a resource file.

See how this is done correctly. Just replace the import and change QtWidgets to QtGui, since I have PyQt5

#from PySide import QtCore, QtGui
from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(400, 300)
        self.pushButton = QtWidgets.QPushButton(Form)
        self.pushButton.setGeometry(QtCore.QRect(170, 190, 75, 23))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(Form)
        self.pushButton_2.setGeometry(QtCore.QRect(170, 230, 75, 23))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label = QtWidgets.QLabel(Form)
        self.label.setGeometry(QtCore.QRect(180, 130, 46, 13))
        self.label.setObjectName("label")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(QtWidgets.QApplication.translate("Form", "Form", None, -1))
        self.pushButton.setText(QtWidgets.QApplication.translate("Form", "Hello world", None, -1))
        self.pushButton_2.setText(QtWidgets.QApplication.translate("Form", "GoodBye", None, -1))
        self.label.setText(QtWidgets.QApplication.translate("Form", "TextLabel", None, -1))


class Widget(QtWidgets.QWidget, Ui_Form):
    def __init__(self, parent=None):
        super(Widget, self).__init__(parent)

        self.setupUi(self)

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)      # <---


if __name__ == "__main__":
   import sys
   app = QtWidgets.QApplication(sys.argv)
   w = Widget()
   w.show()
   sys.exit(app.exec_())

enter a description of the image here

 2
Author: S. Nick, 2020-01-06 17:26:15
def retranslateUi(self, Form):
...
    Form.setWindowFlags(Qt.FramelessWindowHint)
...
 1
Author: Victor VosMottor, 2020-01-06 17:16:49