How to Copy – Paste Multiple Items form QTableView created by QStandardItemModel to a text/excel file?

The difficulty here is that the selected cells in the table may be non-contiguous and not in any particular order. So the task is to calculate the smallest rectangle that will include all the selected cells, and then create a data structure from that which is suitable for passing to a csv writer. Below is … Read more

PyQt4 center window on active screen

Modify your center method to be as follows: def center(self): frameGm = self.frameGeometry() screen = QtGui.QApplication.desktop().screenNumber(QtGui.QApplication.desktop().cursor().pos()) centerPoint = QtGui.QApplication.desktop().screenGeometry(screen).center() frameGm.moveCenter(centerPoint) self.move(frameGm.topLeft()) This function is based on where the mouse point is located. It uses the screenNumber function to determine which screen the mouse is current active on. It then finds the screenGeometry of that monitor … Read more

What is the easiest way to achieve realtime plotting in pyqtgraph

Pyqtgraph only enables realtime plotting by being quick to draw new plot data. How to achieve realtime plotting is highly dependent on the details and control flow in your application. The most common ways are: Plot data within a loop that makes calls to QApplication.processEvents(). pw = pg.plot() while True: … pw.plot(x, y, clear=True) pg.QtGui.QApplication.processEvents() … Read more