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. cmd info in a Qt window
Forum Updated to NodeBB v4.3 + New Features

cmd info in a Qt window

Scheduled Pinned Locked Moved Unsolved Qt for Python
8 Posts 3 Posters 1.2k Views 2 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.
  • S Offline
    S Offline
    Satil
    wrote on last edited by
    #1

    I'm creating a code and everything is working fine, but I'm running it in a cmd screen, how would I put it in a specific Qt window? I tried the OpenGl widget , Plain text Edit , Dock Widget , widget , Frame option but I couldn't (I don't know if I was directing it wrong because I'm new in the area) the image shows the cmd with the information I'm trying to put in Qt, this window that is in Qt is Plain Text EditSem título.png I want to put this data that is appearing in the CMD in the Qt window

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

      Hi and welcome to devnet,

      What exactly are you running ?
      Without knowing that, it's impossible to help you.

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

      S 1 Reply Last reply
      0
      • S Offline
        S Offline
        Satil
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • S Satil

          I'm creating a code and everything is working fine, but I'm running it in a cmd screen, how would I put it in a specific Qt window? I tried the OpenGl widget , Plain text Edit , Dock Widget , widget , Frame option but I couldn't (I don't know if I was directing it wrong because I'm new in the area) the image shows the cmd with the information I'm trying to put in Qt, this window that is in Qt is Plain Text EditSem título.png I want to put this data that is appearing in the CMD in the Qt window

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

          @Satil
          If it is your own source code which is e.g. outputting to cout/stdout, change it to emit signals and in a slot append it to the QPlianTextEdit. If it is another application use QProcess to run it and grab its output.

          S 1 Reply Last reply
          1
          • SGaistS SGaist

            Hi and welcome to devnet,

            What exactly are you running ?
            Without knowing that, it's impossible to help you.

            S Offline
            S Offline
            Satil
            wrote on last edited by
            #5

            @SGaist I'm creating a code for automatic entries in binary operations, and this information that appears in the CMD is the code analyzing, and when it sees the moment, it makes an entry

            1 Reply Last reply
            0
            • JonBJ JonB

              @Satil
              If it is your own source code which is e.g. outputting to cout/stdout, change it to emit signals and in a slot append it to the QPlianTextEdit. If it is another application use QProcess to run it and grab its output.

              S Offline
              S Offline
              Satil
              wrote on last edited by
              #6

              @JonB I'm new to programming, so I don't know what the code to call in PlainTextEdit would look like, could you give an example of how it would look?How would you call the def monitor in PlainTextEdit?Sem título2.png

              JonBJ 1 Reply Last reply
              0
              • S Satil

                @JonB I'm new to programming, so I don't know what the code to call in PlainTextEdit would look like, could you give an example of how it would look?How would you call the def monitor in PlainTextEdit?Sem título2.png

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

                @Satil
                Please paste text, not screenshots, so people can copy.

                    self.ui.plainTextEdit.setPlainText(self.monitor())
                
                def monitor(self):
                    return "oi"
                

                Or

                def monitor(self):
                    self.ui.plainTextEdit.appendPlainText("ABC")
                    self.ui.plainTextEdit.appendPlainText("DEF")
                    ...
                

                Or raise signals from monitor() with the text as parameter and attach slot to append to plain text edit.

                You cannot easily just cause Python print() statements to appear in a QPlainTextEdit. So depends whether you are in charge of the print() statements.

                S 1 Reply Last reply
                1
                • JonBJ JonB

                  @Satil
                  Please paste text, not screenshots, so people can copy.

                      self.ui.plainTextEdit.setPlainText(self.monitor())
                  
                  def monitor(self):
                      return "oi"
                  

                  Or

                  def monitor(self):
                      self.ui.plainTextEdit.appendPlainText("ABC")
                      self.ui.plainTextEdit.appendPlainText("DEF")
                      ...
                  

                  Or raise signals from monitor() with the text as parameter and attach slot to append to plain text edit.

                  You cannot easily just cause Python print() statements to appear in a QPlainTextEdit. So depends whether you are in charge of the print() statements.

                  S Offline
                  S Offline
                  Satil
                  wrote on last edited by
                  #8

                  @JonB Perfect, I managed to run it without problem, now it's the way the program asks, thank you very much :)
                  e06d0db8-3b9d-4e9e-be9d-ac8adb71b520-image.png

                  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