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. textEdit takes 4 seconds to show up the text

textEdit takes 4 seconds to show up the text

Scheduled Pinned Locked Moved Solved Qt for Python
19 Posts 3 Posters 4.4k 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.
  • A adrian88888888

    @JonB but i'm not supposed to use PySide2 in order to use Qt in python? as i understand pyside2 its the intermediate between qt and python?

    or i'm all wrong?

    now that you say, PyQt has a py in front for some reason, omg tell me that's it

    what i'm supposed to import then?

    oh no, this has a delay too:

    import sys
    from PyQt5.QtWidgets import *
    
    app = QApplication(sys.argv)
    window = QLineEdit()
    window.show()
    sys.exit(app.exec_())
    
    JonBJ Online
    JonBJ Online
    JonB
    wrote on last edited by
    #10

    @adrian88888888
    Not that any of the rest of us have it. But is this delay only if you rapidly type a few characters, or is it equally if you just type one character? And not in any other application, like Notepad?

    A 1 Reply Last reply
    0
    • JonBJ JonB

      @adrian88888888
      Not that any of the rest of us have it. But is this delay only if you rapidly type a few characters, or is it equally if you just type one character? And not in any other application, like Notepad?

      A Offline
      A Offline
      adrian88888888
      wrote on last edited by
      #11

      @JonB it is the same delay, doesn't matter what i type, i can type one letter and the delay its 4 seconds too

      the delay happens at the first time i write in the textEdit, if i delete the text and start writing again the delay its gone

      this happens only in this application, does not happen in notepad or others

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

        @adrian88888888 said in textEdit takes 4 seconds to show up the text:

        @JonB but i'm not supposed to use PySide2 in order to use Qt in python? as i understand pyside2 its the intermediate between qt and python?

        PyQt is a different project that existed long before PySide2. It is also provided by a different company under a different set of licences.

        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
        0
        • A Offline
          A Offline
          adrian88888888
          wrote on last edited by
          #13

          i got no idea what to do, i reduced the problem to his minimum escence:

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

          what is the next step? i should report this as a bug? but i don't know if its a bug

          can someone run this code and see? so i can uncheck the fact that i'm not crazy

          at least i could know if its only me

          JonBJ 1 Reply Last reply
          0
          • A adrian88888888

            i got no idea what to do, i reduced the problem to his minimum escence:

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

            what is the next step? i should report this as a bug? but i don't know if its a bug

            can someone run this code and see? so i can uncheck the fact that i'm not crazy

            at least i could know if its only me

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #14

            @adrian88888888
            Realistically: You would be best to uninstall everything, Qt itself in particular, both PyQt5 and PySide2. Reinstall from scratch. And/or, try on another PC.

            By all means what and see if anyone else is reporting that QLineEdits have a 4 second delay.

            A 1 Reply Last reply
            0
            • JonBJ JonB

              @adrian88888888
              Realistically: You would be best to uninstall everything, Qt itself in particular, both PyQt5 and PySide2. Reinstall from scratch. And/or, try on another PC.

              By all means what and see if anyone else is reporting that QLineEdits have a 4 second delay.

              A Offline
              A Offline
              adrian88888888
              wrote on last edited by adrian88888888
              #15

              @JonB I tried in another pc and it's the same problem, I will see in the bug reports or something

              JonBJ 1 Reply Last reply
              0
              • A adrian88888888

                @JonB I tried in another pc and it's the same problem, I will see in the bug reports or something

                JonBJ Online
                JonBJ Online
                JonB
                wrote on last edited by
                #16

                @adrian88888888
                It would mean that the simplest Qt line edit program has a delay for everyone. Which would have been noticed.

                It is just possible that something is going on in the background while your program is still initializing, if you are typing into this line edit the moment you see the window. If you wait a few seconds before typing your first character, is there still a delay? It's mystifying :)

                A 1 Reply Last reply
                0
                • JonBJ JonB

                  @adrian88888888
                  It would mean that the simplest Qt line edit program has a delay for everyone. Which would have been noticed.

                  It is just possible that something is going on in the background while your program is still initializing, if you are typing into this line edit the moment you see the window. If you wait a few seconds before typing your first character, is there still a delay? It's mystifying :)

                  A Offline
                  A Offline
                  adrian88888888
                  wrote on last edited by adrian88888888
                  #17

                  @JonB Yes it's really mystifying

                  The answer it's: the delay keeps being there
                  alt text

                  No one would noticed this, because no one has a program with just a textEdit, in my case I want that

                  I will see, Idk, pray for me :P

                  JonBJ 1 Reply Last reply
                  0
                  • A adrian88888888

                    @JonB Yes it's really mystifying

                    The answer it's: the delay keeps being there
                    alt text

                    No one would noticed this, because no one has a program with just a textEdit, in my case I want that

                    I will see, Idk, pray for me :P

                    JonBJ Online
                    JonBJ Online
                    JonB
                    wrote on last edited by
                    #18

                    @adrian88888888
                    To keep you happy, I tried this on my system --- Ubuntu 20.04 (I think you are Windows), PyQt version: 5.14.1, Qt version: 5.12.8. I also tested with PySide2. As expected they behave fine, no delay.

                    Try this little piece of code:

                    import sys
                    from PyQt5.QtWidgets import *
                    
                    def textEdited():
                      print("Text edited")
                    
                    if __name__ == '__main__':
                      app = QApplication(sys.argv)
                      window = QLineEdit()
                      window.textEdited.connect(textEdited)
                      window.show()
                      sys.exit(app.exec_())
                    

                    If you run this from a Command Prompt --- python path-to-your-file.py --- it will print Text edited as soon as it detects a character press in your QLineEdit. For me that of course is immediate. What about for you? This distinguishes between when Qt sees the key press versus if there is some issue updating the QLineEdit to show the character, if there is any discrepancy.

                    The fact that you have "only* a QTextEdit should be neither here nor there. Of course you can build a more complex situation, but from what you showed earlier one would think you will have the same problem wherever you use a QLineEdit.

                    If you hadn't said you have tried on another PC and found same problem I would have said it was your PC. Since your problem occurs under both PyQt5 & PySide2 I would assume your problem lies in the Qt, or even the windowing system, not in the Python side. You presumably installed the same Qt version on both PCs? Can you try installing some other version of Qt to test?

                    A 1 Reply Last reply
                    2
                    • JonBJ JonB

                      @adrian88888888
                      To keep you happy, I tried this on my system --- Ubuntu 20.04 (I think you are Windows), PyQt version: 5.14.1, Qt version: 5.12.8. I also tested with PySide2. As expected they behave fine, no delay.

                      Try this little piece of code:

                      import sys
                      from PyQt5.QtWidgets import *
                      
                      def textEdited():
                        print("Text edited")
                      
                      if __name__ == '__main__':
                        app = QApplication(sys.argv)
                        window = QLineEdit()
                        window.textEdited.connect(textEdited)
                        window.show()
                        sys.exit(app.exec_())
                      

                      If you run this from a Command Prompt --- python path-to-your-file.py --- it will print Text edited as soon as it detects a character press in your QLineEdit. For me that of course is immediate. What about for you? This distinguishes between when Qt sees the key press versus if there is some issue updating the QLineEdit to show the character, if there is any discrepancy.

                      The fact that you have "only* a QTextEdit should be neither here nor there. Of course you can build a more complex situation, but from what you showed earlier one would think you will have the same problem wherever you use a QLineEdit.

                      If you hadn't said you have tried on another PC and found same problem I would have said it was your PC. Since your problem occurs under both PyQt5 & PySide2 I would assume your problem lies in the Qt, or even the windowing system, not in the Python side. You presumably installed the same Qt version on both PCs? Can you try installing some other version of Qt to test?

                      A Offline
                      A Offline
                      adrian88888888
                      wrote on last edited by adrian88888888
                      #19

                      @JonB You are being too generous with me for helping me all the way, i don't want to take more of your efforts

                      I just added some text and deleted it in the first run of the program, like this:

                      self.ui.textEdit.setText('hello world')
                      self.ui.textEdit.setText('')
                      

                      and the delay its gone with that

                      If for some reason if i need to fix this i will come back to it, but i really hope really bad to not have to fix this(because is so hard to troubleshoot)

                      Btw it looks that its something related with windows 10 because in your ubuntu works and i tried in 2 windows 10 machines and didn't work

                      printing "Text edited" has delay too

                      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