S
S
suka_vanya2021-08-03 18:28:53
PyQt
suka_vanya, 2021-08-03 18:28:53

How to add flags for a window?

Conditionally I have a code

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(611, 318)
        MainWindow.setMinimumSize(QtCore.QSize(611, 318))
        MainWindow.setMaximumSize(QtCore.QSize(611, 318))
        font = QtGui.QFont()
        font.setBold(False)
        font.setWeight(50)
        MainWindow.setFont(font)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("icon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        MainWindow.setStyleSheet("background-color: rgb(108, 108, 162);")
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.Lable_Name = QtWidgets.QLabel(self.centralwidget)
        self.Lable_Name.setEnabled(True)
        self.Lable_Name.setGeometry(QtCore.QRect(50, 10, 591, 31))
...


How can I paste here
class Main(QMainWindow):
    def __init__(self):
        super(Main, self).__init__()
        self.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint)


I need the window to be borderless and stay on top of all windows

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question