0

I am interested in real time graph. My aim is to update graph with another definition callback. I tried to debug but I don't see anythink after exec_() command. I tried to call update insteaded of Qtimer.

from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
from multiprocessing import Process, Manager,Queue

def f(name):
 app2 = QtGui.QApplication([])

 win2 = pg.GraphicsWindow(title="Basic plotting examples")
 win2.resize(1000,600)
 win2.setWindowTitle('pyqtgraph example: Plotting')
 p2 = win2.addPlot(title="Updating plot")
 curve = p2.plot(pen='y')

 def updateInProc(curve):
    t = np.arange(0,3.0,0.01)
    s = np.sin(2 * np.pi * t + updateInProc.i)
    curve.setData(t,s)
    updateInProc.i += 0.1
    QtGui.QApplication.instance().exec_()

 updateInProc.i = 0

 timer = QtCore.QTimer()
 timer.timeout.connect(lambda: updateInProc(curve))
 timer.start(50)

if __name__ == '__main__':
 m=f()
 m

I want to use another definition like

def UpdateCallback():
    for x in range(1,100):
      m.updateInProc(x,time)

I deleted Qtimer then I tried to send data but I did not see at graph

  • See [this](https://matplotlib.org/api/animation_api.html), if you strictly don't require `pyqtgraph`, this uses `matplotlib`. – akshayk07 Mar 11 '18 at 09:38
  • Why are you calling `exec_()` multiple times? Just move that line to the end of the `f` function after you create the timer. – three_pineapples Mar 11 '18 at 10:35
  • what is `time`? – eyllanesc Mar 11 '18 at 15:07
  • I want to use pyqtgraph because it's faster than matplotlib. Speed is important for my application. @ akshayk07 Normally exec_() command is outside of for but it is a mistake. @three_pineapples . I don't want to use with time I have another funtion for data creation. I want to update when my data is ready @ eyllanesc – Sefa Yerli Mar 13 '18 at 16:37

0 Answers0