Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to open the same window multiple times? But without close the others windows?
Forum Updated to NodeBB v4.3 + New Features

How to open the same window multiple times? But without close the others windows?

Scheduled Pinned Locked Moved Unsolved Qt for Python
3 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Black CatB Offline
    Black CatB Offline
    Black Cat
    wrote on last edited by
    #1

    Well, I need to open this Window "QMainWindow()" multiple times, but, without close the previous windows? Anyone can help me?

    [imports]
    
    class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
        def __init__(self):
            super(MainWindow, self).__init__()
            self.setupUi(self)
            self.ButtoIniciarAnalise.clicked.connect(self.Call) #Procurar
            self.LimparSites()
    
        #
        def LimparSites(self):
            self.plainTextDados.clear()
            with open('Bin/Config/User/Root/DefaultSearch.txt', 'r') as File:
                File = File.read()
                self.plainTextDados.insertPlainText(File)
    
        def ProgressWindow(self):
            self.window = QtWidgets.QMainWindow
    
    ######### THIS WINDOW #########
        def Call(self):
            self.w = PWMainWindow()
            self.w.show()
    ################################
    
        def LimparSites1():
            plainTextDados.clear()
            with open('Bin/Config/User/Root/DefaultSearch.txt', 'r') as File:
                File = File.read()
                plainTextDados.insertPlainText(File)
    
    if __name__ == "__main__":
        app = QtWidgets.QApplication(sys.argv)
        window = MainWindow()
        window.show()
        sys.exit(app.exec_())
    
    JonBJ 1 Reply Last reply
    0
    • Black CatB Black Cat

      Well, I need to open this Window "QMainWindow()" multiple times, but, without close the previous windows? Anyone can help me?

      [imports]
      
      class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
          def __init__(self):
              super(MainWindow, self).__init__()
              self.setupUi(self)
              self.ButtoIniciarAnalise.clicked.connect(self.Call) #Procurar
              self.LimparSites()
      
          #
          def LimparSites(self):
              self.plainTextDados.clear()
              with open('Bin/Config/User/Root/DefaultSearch.txt', 'r') as File:
                  File = File.read()
                  self.plainTextDados.insertPlainText(File)
      
          def ProgressWindow(self):
              self.window = QtWidgets.QMainWindow
      
      ######### THIS WINDOW #########
          def Call(self):
              self.w = PWMainWindow()
              self.w.show()
      ################################
      
          def LimparSites1():
              plainTextDados.clear()
              with open('Bin/Config/User/Root/DefaultSearch.txt', 'r') as File:
                  File = File.read()
                  plainTextDados.insertPlainText(File)
      
      if __name__ == "__main__":
          app = QtWidgets.QApplication(sys.argv)
          window = MainWindow()
          window.show()
          sys.exit(app.exec_())
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Black-Cat
      Guessing what you asking...

      If you mean you want to open multiple copies of the window, you must create multiple instances:

          window1 = MainWindow()
          window1.show()
          window2 = MainWindow()
          window2.show()
      
      # or
      
          def Call(self):
              self.w1 = PWMainWindow()
              self.w1.show()
              self.w2 = PWMainWindow()
              self.w2.show()
      
      1 Reply Last reply
      2
      • Black CatB Offline
        Black CatB Offline
        Black Cat
        wrote on last edited by
        #3

        Thanks, dude...

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved