I have a list of points. For example, points = [[160, 75], [115, 567]]
.
How to draw a line in PyQt4, so it would be something like this:
Either of these two would have similar approaches where during your draw you would have to build the line incrementally over time. Review your own previous question for a specific example of how to draw a line over time: Make an animated wave with drawPolyline in PySide/PyQt
As an example, if you were using QGraphics, then you would have a QGraphicsPathItem instance in your scene. Then you would animate it by looping and updating QPainterPath by incrementally setting the complete path: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qpainterpath.html#cubicTo
Refer the below code in your paint event to draw a line in Qt.
def paintEvent(self, event):
painter = Qt.QPainter()
painter.begin(self)
painter.pen().setWidth(int width)
painter.setPen(Qt.QColor(100,100,100))
painter.drawLine(x1,y1,x2,y2)
painter.end()
Qt.QFrame.paintEvent(self, event)