Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWidget.Show()
Qt 6.11 is out! See what's new in the release blog

QWidget.Show()

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 384 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.
  • C Offline
    C Offline
    Caeden
    wrote on last edited by Caeden
    #1

    im using async qt (this shouldnt make a difference that much for what i'm doing right here) -

    https://github.com/CaedenPH/integrated-bot-gui/tree/main/bot-gui -- > this is the whole code, not that it makes that much difference i think.

    @asyncSlot()
        async def send_message(self):
            window = QtWidgets.QWidget()
    
            ui = Sendmessage_Dialog()
            ui.setupUi(window)
    
            window.show()
    

    this is called at the main.py;

    def windowLauncher():
        """Launch panel"""
    
    
        app = QtWidgets.QApplication(sys.argv)
        loop = QEventLoop(app)
    
        asyncio.set_event_loop(loop)
    
        win = MainWindow()
        win.show()
        
    
        loop.run_forever()
    
    
    
    
    if __name__ == "__main__":
        windowLauncher()    
    

    I've noticed that when I make a function and use show in it it only shows for a split second? am I using this incorrectly?

    sorry for long post

    eyllanescE 1 Reply Last reply
    0
    • C Caeden

      im using async qt (this shouldnt make a difference that much for what i'm doing right here) -

      https://github.com/CaedenPH/integrated-bot-gui/tree/main/bot-gui -- > this is the whole code, not that it makes that much difference i think.

      @asyncSlot()
          async def send_message(self):
              window = QtWidgets.QWidget()
      
              ui = Sendmessage_Dialog()
              ui.setupUi(window)
      
              window.show()
      

      this is called at the main.py;

      def windowLauncher():
          """Launch panel"""
      
      
          app = QtWidgets.QApplication(sys.argv)
          loop = QEventLoop(app)
      
          asyncio.set_event_loop(loop)
      
          win = MainWindow()
          win.show()
          
      
          loop.run_forever()
      
      
      
      
      if __name__ == "__main__":
          windowLauncher()    
      

      I've noticed that when I make a function and use show in it it only shows for a split second? am I using this incorrectly?

      sorry for long post

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by eyllanesc
      #2

      @Caeden Read about scope of variables. In your case window and ui are local variables so they will be removed after the function is executed. Change to:

      @asyncSlot()
      async def send_message(self):
          self.window = QtWidgets.QWidget()
          self.ui = Sendmessage_Dialog()
          self.ui.setupUi(self.window)
          self.window.show()
      

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Caeden
        wrote on last edited by Caeden
        #3

        Ah okay thank you - it worked :)

        1 Reply Last reply
        1

        • Login

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