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. Displaying real-time data on a 2nd window
Forum Updated to NodeBB v4.3 + New Features

Displaying real-time data on a 2nd window

Scheduled Pinned Locked Moved Unsolved General and Desktop
51 Posts 4 Posters 8.1k 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.
  • J Offline
    J Offline
    john_hobbyist
    wrote on last edited by
    #40
    This post is deleted!
    JonBJ 1 Reply Last reply
    0
    • J john_hobbyist

      This post is deleted!

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

      @john_hobbyist said in Displaying real-time data on a 2nd window:

      mylayout.addWidget(self.imageviewer, 1, 1)

      You're not reading @SGaist's replies and understanding/acting on them. Anyway, what do you intend this line to do?

      1 Reply Last reply
      1
      • J Offline
        J Offline
        john_hobbyist
        wrote on last edited by
        #42

        @SGaist @JonB: You are right!!!! Thanks!

        1 Reply Last reply
        0
        • J Offline
          J Offline
          john_hobbyist
          wrote on last edited by john_hobbyist
          #43

          I call the above class each time the mouse pointer changes position. The problem is that nothing is shown..but the print commands that I have embed between the below commands work!
          Why?
          I call it like this:

          w = Town()
          w.show()
          

          This is the class that I call

          class Town(QWidget):
              def __init__(self):
                  super().__init__()
                  import sys
                  from PyQt5.QtWidgets import QWidget,QPushButton,QApplication,QListWidget,QGridLayout,QLabel
                  from PyQt5.QtCore import QTimer,QDateTime
                  from PyQt5 import QtWidgets
                  from PyQt5.QtWidgets import QApplication, QMainWindow
                  from PyQt5 import QtCore
                  
                  win = QWidget()
                  grid=QGridLayout()
                 
                  import pandas
                  ct = pandas.read_csv('CurrentTown.csv')
                  town = QLabel("town:")
                  town.setStyleSheet("border: 1px solid black; background-color: yellow")  
                  grid.addWidget(town, 1,1)
                  textEdit_1 = QLineEdit(ct)
                  textEdit_1.setReadOnly(True)
                  grid.addWidget(textEdit_1,1,2)
          
                  
                  import os
                  os.remove('CurrentTown.csv')
              
                  self.setLayout(grid)
                  win.setGeometry(100,100,200,100)
                  win.setWindowTitle("Test")
                  win.show()
                  win.update()
          jsulmJ 1 Reply Last reply
          0
          • J john_hobbyist

            I call the above class each time the mouse pointer changes position. The problem is that nothing is shown..but the print commands that I have embed between the below commands work!
            Why?
            I call it like this:

            w = Town()
            w.show()
            

            This is the class that I call

            class Town(QWidget):
                def __init__(self):
                    super().__init__()
                    import sys
                    from PyQt5.QtWidgets import QWidget,QPushButton,QApplication,QListWidget,QGridLayout,QLabel
                    from PyQt5.QtCore import QTimer,QDateTime
                    from PyQt5 import QtWidgets
                    from PyQt5.QtWidgets import QApplication, QMainWindow
                    from PyQt5 import QtCore
                    
                    win = QWidget()
                    grid=QGridLayout()
                   
                    import pandas
                    ct = pandas.read_csv('CurrentTown.csv')
                    town = QLabel("town:")
                    town.setStyleSheet("border: 1px solid black; background-color: yellow")  
                    grid.addWidget(town, 1,1)
                    textEdit_1 = QLineEdit(ct)
                    textEdit_1.setReadOnly(True)
                    grid.addWidget(textEdit_1,1,2)
            
                    
                    import os
                    os.remove('CurrentTown.csv')
                
                    self.setLayout(grid)
                    win.setGeometry(100,100,200,100)
                    win.setWindowTitle("Test")
                    win.show()
                    win.update()
            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #44

            @john_hobbyist said in Displaying real-time data on a 2nd window:

            I call it like this:

            Where?
            Please show that part of your code.
            Also, why do you create a new QWidget in Town which does not contain anything? Town is already a QWidget.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            J 1 Reply Last reply
            1
            • jsulmJ jsulm

              @john_hobbyist said in Displaying real-time data on a 2nd window:

              I call it like this:

              Where?
              Please show that part of your code.
              Also, why do you create a new QWidget in Town which does not contain anything? Town is already a QWidget.

              J Offline
              J Offline
              john_hobbyist
              wrote on last edited by john_hobbyist
              #45

              @jsulm said in Displaying real-time data on a 2nd window:

              @john_hobbyist said in Displaying real-time data on a 2nd window:

              I call it like this:

              Where?
              Please show that part of your code.
              Also, why do you create a new QWidget in Town which does not contain anything? Town is already a QWidget.

              You mean this (?) :

              win = QWidget()
              . . . 
              win.setGeometry(100,100,200,100)
              win.setWindowTitle("Test")
              win.show()
              win.update()
              

              So, class Town(QWidget): makes a widget before the previous code...(?)

              jsulmJ 1 Reply Last reply
              0
              • J john_hobbyist

                @jsulm said in Displaying real-time data on a 2nd window:

                @john_hobbyist said in Displaying real-time data on a 2nd window:

                I call it like this:

                Where?
                Please show that part of your code.
                Also, why do you create a new QWidget in Town which does not contain anything? Town is already a QWidget.

                You mean this (?) :

                win = QWidget()
                . . . 
                win.setGeometry(100,100,200,100)
                win.setWindowTitle("Test")
                win.show()
                win.update()
                

                So, class Town(QWidget): makes a widget before the previous code...(?)

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #46

                @john_hobbyist said in Displaying real-time data on a 2nd window:

                You mean this

                Yes. Why do you need win?
                All other widgets you create in Town are added to Town.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                J 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @john_hobbyist said in Displaying real-time data on a 2nd window:

                  You mean this

                  Yes. Why do you need win?
                  All other widgets you create in Town are added to Town.

                  J Offline
                  J Offline
                  john_hobbyist
                  wrote on last edited by
                  #47

                  @jsulm said in Displaying real-time data on a 2nd window:

                  @john_hobbyist said in Displaying real-time data on a 2nd window:

                  You mean this

                  Yes. Why do you need win?
                  All other widgets you create in Town are added to Town.

                  And what I do with these?

                  win.setGeometry(100,100,200,100)
                  win.setWindowTitle("Test")
                  win.show()
                  win.update()
                  

                  I call them with self???

                  jsulmJ 1 Reply Last reply
                  0
                  • J john_hobbyist

                    @jsulm said in Displaying real-time data on a 2nd window:

                    @john_hobbyist said in Displaying real-time data on a 2nd window:

                    You mean this

                    Yes. Why do you need win?
                    All other widgets you create in Town are added to Town.

                    And what I do with these?

                    win.setGeometry(100,100,200,100)
                    win.setWindowTitle("Test")
                    win.show()
                    win.update()
                    

                    I call them with self???

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #48

                    @john_hobbyist said in Displaying real-time data on a 2nd window:

                    And what I do with these?

                    I don't know what you want to do with this.
                    You simply create a widget without parent and show it - it will be a stand-alone WINDOW.

                    "I call them with self???" - what does this mean? If you're asking me how you should change it: then I repeat my question "Why do you need it at all"?! Can you first answer this question?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • J Offline
                      J Offline
                      john_hobbyist
                      wrote on last edited by john_hobbyist
                      #49

                      I call the class (from another class) like this:

                      w = Town()
                      w.show()
                      

                      how could the Qwidget be displayed if I do not include these (?) :

                      win.setGeometry(100,100,200,100)
                      win.setWindowTitle("Test")
                      win.show()
                      win.update()
                      

                      Especially win.show

                      Update: I removed the above mentioned lines. I put a sleep method for 10 sec. The code opens a window but it does not have something inside...and looks like it "stucks".

                      jsulmJ 1 Reply Last reply
                      0
                      • J john_hobbyist

                        I call the class (from another class) like this:

                        w = Town()
                        w.show()
                        

                        how could the Qwidget be displayed if I do not include these (?) :

                        win.setGeometry(100,100,200,100)
                        win.setWindowTitle("Test")
                        win.show()
                        win.update()
                        

                        Especially win.show

                        Update: I removed the above mentioned lines. I put a sleep method for 10 sec. The code opens a window but it does not have something inside...and looks like it "stucks".

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #50

                        @john_hobbyist I really have no idea what you want to do!
                        If you want to show Town all you need is

                        w = Town()
                        w.show()
                        

                        So, once more: why do you need win? win is ANOTHER widget, it is not Town! If you refuse to answer this simple question I'm out of this thread.
                        "but it does not have something inside...and looks like it "stucks"." - this is also something I already told you: you are showing a widget (win) which has no parent, so it is shown as a window. And since win does not contain any other widgets it is an empty window.

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        J 1 Reply Last reply
                        1
                        • jsulmJ jsulm

                          @john_hobbyist I really have no idea what you want to do!
                          If you want to show Town all you need is

                          w = Town()
                          w.show()
                          

                          So, once more: why do you need win? win is ANOTHER widget, it is not Town! If you refuse to answer this simple question I'm out of this thread.
                          "but it does not have something inside...and looks like it "stucks"." - this is also something I already told you: you are showing a widget (win) which has no parent, so it is shown as a window. And since win does not contain any other widgets it is an empty window.

                          J Offline
                          J Offline
                          john_hobbyist
                          wrote on last edited by john_hobbyist
                          #51

                          @jsulm said in Displaying real-time data on a 2nd window:

                          @john_hobbyist I really have no idea what you want to do!
                          If you want to show Town all you need is

                          w = Town()
                          w.show()
                          

                          So, once more: why do you need win? win is ANOTHER widget, it is not Town! If you refuse to answer this simple question I'm out of this thread.
                          "but it does not have something inside...and looks like it "stucks"." - this is also something I already told you: you are showing a widget (win) which has no parent, so it is shown as a window. And since win does not contain any other widgets it is an empty window.

                          Ok, so I do not need it...! As I understand now this is wrong there! (You know how things are for new programmers, using code from websites and trying to learn/experiment and build something...)

                          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