title: Removing Title bar from Window
body: <p>I want to remove title bar and all uncessary space inside the window in pyqt5 for this I am using self.setWindowFlags(QtCore.Qt.WindowType.FramelessWindowHint)  but i am getting error 'Ui_mainWindow' object has no attribute 'setWindowFlags'.</p>
  <pre><code># -*- coding: utf-8 -*-
  
  # Form implementation generated from reading ui file 'window1.ui'
  #
  # Created by: PyQt5 UI code generator 5.15.7
  #
  # WARNING: Any manual changes made to this file will be lost when pyuic5 is
  # run again.  Do not edit this file unless you know what you are doing.
  
  
  from PyQt5 import QtCore, QtGui, QtWidgets
  from window2 import Ui_Dialog
  from pop import Ui_WizardPage
  from PyQt5.QtWidgets import QMainWindow, QApplication, QLCDNumber
  from PyQt5 import uic
  import sys
  from PyQt5.QtWidgets import QApplication, QWidget
  from PyQt5.QtWidgets import QVBoxLayout, QLabel
  from PyQt5.QtGui import QFont
  from PyQt5.QtCore import QTimer, QTime, Qt
  from PyQt5.QtCore import QTime, QTimer
  #from datetime import datetime
  import pyautogui
  import random
  import time
  import datetime
  
  start = datetime.datetime.now() 
  
  class Ui_mainWindow(object):
      def openWindow(self):
          self.window = QtWidgets.QDialog()
          self.ui = Ui_Dialog()
          self.ui.setupUi(self.window)
          self.window.show()
  
      def openWizard(self):
          self.wizard = QtWidgets.QWizardPage()
          self.ui = Ui_WizardPage()
          self.ui.setupUi(self.wizard)
          self.wizard.show()
  
      def setupUi(self, mainWindow):
          mainWindow.setObjectName(&quot;mainWindow&quot;)
          mainWindow.resize(422, 390)
          #self.setWindowFlags(QtCore.Qt.WindowType.FramelessWindowHint)
          #self.setAttribute(QtCore.Qt.WidgetAttribute.WA_TranslucentBackground)
          self.centralwidget = QtWidgets.QWidget(mainWindow)
          self.centralwidget.setObjectName(&quot;centralwidget&quot;)
          self.label = QtWidgets.QLabel(self.centralwidget)
          self.label.setGeometry(QtCore.QRect(110, 40, 311, 41))
          self.label.setStyleSheet(&quot;QLabel{\n&quot;
  &quot; border : 1px solid;\n&quot;
  &quot; border-color:rgb(215, 184, 0);\n&quot;
  &quot;}&quot;)
          self.label.setText(&quot;&quot;)
          self.label.setPixmap(QtGui.QPixmap(&quot;../../../Downloads/New folder (1)/New folder/image14.png&quot;))
          self.label.setObjectName(&quot;label&quot;)
          self.label_3 = QtWidgets.QLabel(self.centralwidget)
          self.label_3.setGeometry(QtCore.QRect(110, 0, 311, 41))
          self.label_3.setStyleSheet(&quot;QLabel{\n&quot;
  &quot; border : 1px solid;\n&quot;
  &quot; border-color:rgb(215, 184, 0);\n&quot;
  &quot;}&quot;)
          self.label_3.setText(&quot;&quot;)
          self.label_3.setPixmap(QtGui.QPixmap(&quot;../../../Downloads/New folder (1)/New folder/image7.png&quot;))
          self.label_3.setObjectName(&quot;label_3&quot;)
          self.label_5 = QtWidgets.QLabel(self.centralwidget)
          self.label_5.setGeometry(QtCore.QRect(0, 0, 111, 81))
          self.label_5.setStyleSheet(&quot;QLabel{\n&quot;
  &quot; border : 1px solid;\n&quot;
  &quot; border-color:rgb(215, 184, 0);\n&quot;
  &quot;}&quot;)
          self.label_5.setText(&quot;&quot;)
          self.label_5.setObjectName(&quot;label_5&quot;)
          self.pushButton = QtWidgets.QPushButton(self.centralwidget,clicked = lambda: self.openWindow())
          self.pushButton.setGeometry(QtCore.QRect(330, 10, 21, 21))
          self.pushButton.setStyleSheet(&quot;QPushButton{\n&quot;
  &quot;border-style:hidden;\n&quot;
  &quot;background-color:rgb(254, 222, 5);\n&quot;
  &quot;}&quot;)
          self.pushButton.setText(&quot;&quot;)
          icon = QtGui.QIcon()
          icon.addPixmap(QtGui.QPixmap(&quot;../../../Downloads/New folder (1)/New folder/image4.png&quot;), QtGui.QIcon.Normal, QtGui.QIcon.On)
          self.pushButton.setIcon(icon)
          self.pushButton.setObjectName(&quot;pushButton&quot;)
          self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget,clicked = lambda: self.openWizard())
          # adding action to a button
          self.pushButton_2.clicked.connect(self.showTime)
          self.pushButton_2.clicked.connect(self.Start)
          self.pushButton_2.clicked.connect(self.screenshot)
          self.pushButton_2.setGeometry(QtCore.QRect(110, 0, 41, 41))
          self.pushButton_2.setStyleSheet(&quot;QPushButton{\n&quot;
  &quot; border : 1px solid;\n&quot;
  &quot; border-color:rgb(215, 184, 0);\n&quot;
  &quot;border-bottom-style: none;\n&quot;
  &quot;border-top-style: none;\n&quot;
  &quot;border-left-style: none;\n&quot;
  &quot;}&quot;)
          self.pushButton_2.setText(&quot;&quot;)
          icon1 = QtGui.QIcon()
          icon1.addPixmap(QtGui.QPixmap(&quot;../../../Downloads/New folder (1)/New folder/image10.png&quot;), QtGui.QIcon.Normal, QtGui.QIcon.On)
          self.pushButton_2.setIcon(icon1)
          self.pushButton_2.setObjectName(&quot;pushButton_2&quot;)
          self.label_2 = QtWidgets.QLabel(self.centralwidget)
          self.label_2.setGeometry(QtCore.QRect(360, 0, 61, 41))
          self.label_2.setStyleSheet(&quot;QLabel{\n&quot;
  &quot; border : 1px solid;\n&quot;
  &quot; border-color:rgb(215, 184, 0);\n&quot;
  &quot;border-bottom-style: none;\n&quot;
  &quot;border-top-style: none;\n&quot;
  &quot;border-right-style: none;\n&quot;
  &quot;padding-left :8px;\n&quot;
  &quot;}&quot;)    
          # counter
          self.count = 0
          # creating flag
          self.flag = False
          self.label_2.setText(str(self.count))
          # creating a timer object
          self.label_2.setFont(QFont('sans-serif', 10))
          self.timer = QTimer()
          # adding action to timer
          self.timer.timeout.connect(self.showTime)
          # update the timer every tenth second
          self.timer.start(1000)
          #self.label_2.setText(&quot;&quot;)
          self.label_2.setObjectName(&quot;label_2&quot;)
          self.label_4 = QtWidgets.QLabel(self.centralwidget)
          self.label_4.setGeometry(QtCore.QRect(110, 40, 161, 41))
          self.label_4.setStyleSheet(&quot;QLabel{\n&quot;
  &quot;border-style:hidden;\n&quot;
  &quot;font-weight: bold;\n&quot;
  &quot;}&quot;)    
          # creating font object
          font = QFont('Arial', 20, QFont.Bold)
    
          # setting centre alignment to the label
          self.label_4.setAlignment(Qt.AlignCenter)
    
          # setting font to the label
          self.label_4.setFont(font)
    
          # creating a timer object
          self.timers = QTimer()
    
          # adding action to timer
          self.timers.timeout.connect(self.Time)
    
          # update the timer every second
          self.timers.start(1000)
  
          self.label_4.setText(&quot;&quot;)
          self.label_4.setObjectName(&quot;label_4&quot;)
          mainWindow.setCentralWidget(self.centralwidget)
          self.menubar = QtWidgets.QMenuBar(mainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 422, 20))
          self.menubar.setObjectName(&quot;menubar&quot;)
          mainWindow.setMenuBar(self.menubar)
  
          self.retranslateUi(mainWindow)
          QtCore.QMetaObject.connectSlotsByName(mainWindow)
  
      def showTime(self):#
          # checking if flag is true
          if self.flag:
              # incrementing the counter
              #self.count+= 1
              self.elapsed_seconds = (datetime.datetime.now() - start).total_seconds()
              self.hour = int(self.elapsed_seconds // 3600)
              self.min = int(self.elapsed_seconds % 3600 // 60)
              self.seconds = int(self.elapsed_seconds % 60)
              self.count ='{:02d}:{:02d}'.format(self.hour, self.min)
              #self.lcd.display(timer)
              # getting text from count
          text = str(self.count)
    
          # showing text
          self.label_2 .setText(text)
  
      def Start(self):
    
          # making flag to true
          self.flag = True
  
  
  
      # method called by timer
      def Time(self):
    
          # getting current time
          current_time = QTime.currentTime()
          
          
          # converting QTime object to string
          label_time = current_time.toString('hh:mm:ss')
    
          # showing it to the label
          self.label_4.setText(label_time)
  
      def screenshot(self):
          if self.flag:
                  # generating a random number between 1 
                  # to 10 which will represent the time 
                  # delay
                  random_time = random.randint(1, 5)
    
                  # create a time delay using the sleep()
                  # method
                  time.sleep(random_time)
    
                  # Take the screenshot using screenshot()
                  # method
                  myScreenshot = pyautogui.screenshot()
    
                  # Save the screenshot shot using current
                  # time as file name.
                  file_name = str(time.time())+&quot;.png&quot;
                  myScreenshot.save(file_name)
  
      def retranslateUi(self, mainWindow):
          _translate = QtCore.QCoreApplication.translate
          mainWindow.setWindowTitle(_translate(&quot;mainWindow&quot;, &quot;MainWindow&quot;))
  
  
  
  
  
  if __name__ == &quot;__main__&quot;:
      import sys
      app = QtWidgets.QApplication(sys.argv)
      mainWindow = QtWidgets.QMainWindow()
      ui = Ui_mainWindow()
      ui.setupUi(mainWindow)
      mainWindow.show()
      sys.exit(app.exec_())
  </code></pre>
  <p>I want to remove title bar and show only the part i have designed.</p>