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. Qwidget.show() take 5 seconds to load in pyqt5
Forum Updated to NodeBB v4.3 + New Features

Qwidget.show() take 5 seconds to load in pyqt5

Scheduled Pinned Locked Moved Solved Qt for Python
10 Posts 2 Posters 838 Views 1 Watching
  • 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.
  • G Offline
    G Offline
    glikoliz
    wrote on last edited by
    #1

    It take 5 seconds to load even in the simplest apps like this:

    import sys
    from PyQt5.QtWidgets import QApplication, QWidget
    
    app = QApplication(sys.argv)
    window = QWidget()
    window.show()
    sys.exit(app.exec_())
    

    Specifically on show() method. It started a week ago, and I don't know why; before that, the loading was instant

    Using cProfile i get this:

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         1    5.063    5.063    5.063    5.063 {built-in method show}
    

    I'm on Windows 11. python version is 3.10.11, pyqt5 version is 5.15.10. I reinstalled pyqt5, ran it in the venv, still doesn't work. same story with pyqt6. it is always ~5 seconds.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Do you have the same issue with PySide6 ?
      Did you update Windows ? Your graphics driver ? Installed a new application ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Do you have the same issue with PySide6 ?
        Did you update Windows ? Your graphics driver ? Installed a new application ?

        G Offline
        G Offline
        glikoliz
        wrote on last edited by
        #3

        @SGaist hi
        i tried it with pyside6, same result:

        1    5.079    5.079    5.079    5.079 {method 'show' of 'PySide6.QtWidgets.QWidget' objects}
        

        I didn't update windows and graphics driver, nothing at all. before that i installed pyqt5-tools to try qt designer and change my ssd recently, nothing more

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you try to re-install Python ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          G 1 Reply Last reply
          0
          • SGaistS SGaist

            Did you try to re-install Python ?

            G Offline
            G Offline
            glikoliz
            wrote on last edited by
            #5

            @SGaist i tried it with python 3.12.1 in venv, no results. i'm also found something strange: doesn't matter how many show methods i use, this will be always 5 second delay:
            2 qwidget.show():

            ncalls  tottime  percall  cumtime  percall filename:lineno(function)
                 2    5.063    2.532    5.063    2.532 {built-in method show}
            

            3 of them:

            ncalls  tottime  percall  cumtime  percall filename:lineno(function)
                 3    5.096    1.699    5.096    1.699 {built-in method show}
            

            also sry for long answers, there is 600 seconds cooldown

            SGaistS 1 Reply Last reply
            0
            • G glikoliz

              @SGaist i tried it with python 3.12.1 in venv, no results. i'm also found something strange: doesn't matter how many show methods i use, this will be always 5 second delay:
              2 qwidget.show():

              ncalls  tottime  percall  cumtime  percall filename:lineno(function)
                   2    5.063    2.532    5.063    2.532 {built-in method show}
              

              3 of them:

              ncalls  tottime  percall  cumtime  percall filename:lineno(function)
                   3    5.096    1.699    5.096    1.699 {built-in method show}
              

              also sry for long answers, there is 600 seconds cooldown

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @glikoliz The show method schedules for the widget to be shown which should happen as soon as the event loop starts so calling it multiple times should have no effects.

              Do you have a mean to drill more deeply in the call stack ? Show will in the trigger platform specific code.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              G 1 Reply Last reply
              0
              • SGaistS SGaist

                @glikoliz The show method schedules for the widget to be shown which should happen as soon as the event loop starts so calling it multiple times should have no effects.

                Do you have a mean to drill more deeply in the call stack ? Show will in the trigger platform specific code.

                G Offline
                G Offline
                glikoliz
                wrote on last edited by
                #7

                @SGaist how can i see call stack? i tried traceback, cprofile and line_profiler, they all just tell me about built-in method show

                SGaistS 1 Reply Last reply
                0
                • G glikoliz

                  @SGaist how can i see call stack? i tried traceback, cprofile and line_profiler, they all just tell me about built-in method show

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @glikoliz I currently wonder if Visual Studio might be able to give you more details.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  G 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    @glikoliz I currently wonder if Visual Studio might be able to give you more details.

                    G Offline
                    G Offline
                    glikoliz
                    wrote on last edited by
                    #9

                    @SGaist i can't see what's happening in show() method. i don't know what else could i see with any profiler. also just checked, qt on c++ works the same

                    G 1 Reply Last reply
                    0
                    • G glikoliz

                      @SGaist i can't see what's happening in show() method. i don't know what else could i see with any profiler. also just checked, qt on c++ works the same

                      G Offline
                      G Offline
                      glikoliz
                      wrote on last edited by
                      #10

                      @glikoliz ok fixed it by reinstalling windows

                      1 Reply Last reply
                      0
                      • G glikoliz has marked this topic as solved on

                      • Login

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