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. showNormal() makes the app stuck
Forum Updated to NodeBB v4.3 + New Features

showNormal() makes the app stuck

Scheduled Pinned Locked Moved Unsolved Qt for Python
8 Posts 3 Posters 753 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.
  • P Offline
    P Offline
    Prabhav
    wrote on last edited by
    #1

    Hi,

    I am trying to open the main window after minimising it using showNormal().
    But on debugging my app gets stuck at this command and shows not responding. What could be the reason for this?

    SGaistS 1 Reply Last reply
    0
    • P Prabhav

      Hi,

      I am trying to open the main window after minimising it using showNormal().
      But on debugging my app gets stuck at this command and shows not responding. What could be the reason for this?

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

      Hi,

      Are you using PySide 6 / PyQt 6 ?
      Which version ?
      On which OS ?

      Please provide a minimal script that shows that behaviour.

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

      P 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Are you using PySide 6 / PyQt 6 ?
        Which version ?
        On which OS ?

        Please provide a minimal script that shows that behaviour.

        P Offline
        P Offline
        Prabhav
        wrote on last edited by
        #3

        @SGaist i am using PyQt5 on windows 10 with python 3.8.10.

        code snippet-

        (this is inside mainwindow class. As of now, the main waindow [self] is minimized)
        if self.checkbox.isChecked():
        self.showNormal()

        The code gets stuck at the line above and the screen becomes blank and says not responding

        SGaistS 1 Reply Last reply
        0
        • P Prabhav

          @SGaist i am using PyQt5 on windows 10 with python 3.8.10.

          code snippet-

          (this is inside mainwindow class. As of now, the main waindow [self] is minimized)
          if self.checkbox.isChecked():
          self.showNormal()

          The code gets stuck at the line above and the screen becomes blank and says not responding

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

          Please provide a minimal complete scrip to reproduce your issue.

          Also, which version of PyQt5 ?

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

          P 1 Reply Last reply
          0
          • SGaistS SGaist

            Please provide a minimal complete scrip to reproduce your issue.

            Also, which version of PyQt5 ?

            P Offline
            P Offline
            Prabhav
            wrote on last edited by
            #5

            @SGaist i am sorry i am not able to make a minimal reproduction. The error happens sometimes (not always) and not in the case of a simple code. Do you think too many threads can cause the showNormal() function to get stuck? I have used threading in my app.

            PS: I had another window open alongside the main window. And then i gave the command to showNormal on the main window. Maybe thats causing an issue?

            P JonBJ 2 Replies Last reply
            0
            • P Prabhav

              @SGaist i am sorry i am not able to make a minimal reproduction. The error happens sometimes (not always) and not in the case of a simple code. Do you think too many threads can cause the showNormal() function to get stuck? I have used threading in my app.

              PS: I had another window open alongside the main window. And then i gave the command to showNormal on the main window. Maybe thats causing an issue?

              P Offline
              P Offline
              Prabhav
              wrote on last edited by
              #6

              @Prabhav I tried otherwindow.close() before doing self.showNormal() and not it seems to work!! But i have no idea how closing the second window has an impact on opening the first window. Do you have any idea about why this might be happening?

              SGaistS 1 Reply Last reply
              0
              • P Prabhav

                @Prabhav I tried otherwindow.close() before doing self.showNormal() and not it seems to work!! But i have no idea how closing the second window has an impact on opening the first window. Do you have any idea about why this might be happening?

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

                Without your code, no I can't say. You might doing something blocking the event loop.

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

                1 Reply Last reply
                1
                • P Prabhav

                  @SGaist i am sorry i am not able to make a minimal reproduction. The error happens sometimes (not always) and not in the case of a simple code. Do you think too many threads can cause the showNormal() function to get stuck? I have used threading in my app.

                  PS: I had another window open alongside the main window. And then i gave the command to showNormal on the main window. Maybe thats causing an issue?

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #8

                  @Prabhav
                  As @SGaist says. When you have an issue which you cannot reproduce in a minimal example and only happens in some complex code you know that it is going to have something to do with that code and that nobody will be to answer without seeing it!

                  It is a "shame" if you have many threads, that's often not needed in a Qt application, may be overused by beginners and is a frequent source of errors. "Intermittent" behaviour can often happen in thread cases, where the order of operations may vary over time.

                  The first thing to make sure is that no code in your threads accesses (read or write) anything in the UI. That is not allowed in Qt and leads to undefined behaviour. For example (just an example) if the two lines of code you show are executed from a thread (i.e. called directly, not via a signal which the main window has attached a slot to) that would be a no-no. But even if this call is made correctly, if anything else infringes the rule all bets are off for the state of the UI.

                  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