Experiment with VisPy
I've decided to try VisPy by adapting my previous PyQtGraph example. In the process I have figured out something I got wrong about the update
function: I thought the loop that updates the points for the scatterplot had to be inside the update
, and this works with PyQtGraph but doesn't with VisPy. (A GitHub Issue gave me the idea.) This brought me to reconsider the role of update
as a function that should include the changes to data as a timer-controlled operation too. In other words, there should not be a loop inside update
; rather, the loop (or the condition) variable has to be updated inside but declared outside.
Beside this important realization (which I would have probably come across had I read more about Qt and timers), for this use case I haven't seen any big differences between VisPy and PyQtGraph except that VisPy has an easier API to work with, for example:
- The main application in VisPy can just be imported from the main module with
from vispy import app
. - Views are added to a
SceneCanvas
in VisPy. - There are no specific “GL widgets” in VisPy, so a PyQtGraph
GLScatterPlotItem
is just aMarkers
“visual element”. - There are no “Qt modules” in VisPy, so a
QTimer
frompyqtgraph.Qt.QtCore
in PyQtGraph is just anapp.Timer
.