How to use the pyqtgraph.Qt.QtGui.QApplication.instance function in pyqtgraph

To help you get started, we’ve selected a few pyqtgraph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drowe67 / codec2 / octave / fskdemodgui.py View on Github external
time.sleep(0.1)
			continue

		if not in_queue.full():
			in_queue.put_nowait(in_line)

read_thread = Thread(target=read_input)
read_thread.daemon = True # Set as daemon, so when all other threads die, this one gets killed too.
read_thread.start()

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
	import sys
	if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
		try:
			QtGui.QApplication.instance().exec_()
		except KeyboardInterrupt:
			sys.exit(0)
github pyqtgraph / pyqtgraph / pyqtgraph / __init__.py View on Github external
def mkQApp():
    global QAPP
    inst = QtGui.QApplication.instance()
    if inst is None:
        QAPP = QtGui.QApplication([])
    else:
        QAPP = inst
    return QAPP
github mfarhan12 / pycon-canada-2015 / scripts / ECG / plot_serial.py View on Github external
raw_curve.setData(raw_data)

def savecounter():
    ser.close()

import atexit
atexit.register(savecounter)
timer = QtCore.QTimer()
timer.timeout.connect(update)
timer.start(0)

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
github pyqtgraph / pyqtgraph / examples / InfiniteLine.py View on Github external
inf1.setPos([2,2])
p1.addItem(inf1)
p1.addItem(inf2)
p1.addItem(inf3)

# Add a linear region with a label
lr = pg.LinearRegionItem(values=[70, 80])
p1.addItem(lr)
label = pg.InfLineLabel(lr.lines[1], "region 1", position=0.95, rotateAxis=(1,0), anchor=(1, 1))


## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
github pyqtgraph / pyqtgraph / examples / PlotWidget.py View on Github external
def clicked():
    print("curve clicked")
curve.sigClicked.connect(clicked)

lr = pg.LinearRegionItem([1, 30], bounds=[0,100], movable=True)
pw3.addItem(lr)
line = pg.InfiniteLine(angle=90, movable=True)
pw3.addItem(line)
line.setBounds([0,200])

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
github eegsynth / eegsynth / module / plotfreq / plotfreq.py View on Github external
r.set(key, bluefreq+bluewidth)

# Set timer for update
timer = QtCore.QTimer()
timer.timeout.connect(update)
timer.setInterval(10)                   # timeout in milliseconds
timer.start(int(round(stepsize*1000)))  # in milliseconds

# Wait until there is enough data
begsample = -1
while begsample<0:
    hdr_input = ft_input.getHeader()
    begsample = int(hdr_input.nSamples - window)

# Start
QtGui.QApplication.instance().exec_()
github research-team / NEUCOGAR / NEST / misc / common_scripts / PlottingGUI.py View on Github external
a.showGrid(x=True, y=True)

    for i in range(2, len(listing), 2):
        print i
        if i % 3 == 0:
            win.nextRow()
        p1 = win.addPlot(title=title[i/ 2][6:title[i/2].find(',')])
        p1.plot(listing[i], listing[i + 1])
        p1.showGrid(x=True, y=True)
        p1.setXLink(a)
        p1.setYLink(a)

    if __name__ == '__main__':
        import sys
        if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
            QtGui.QApplication.instance().exec_()
github mfarhan12 / pycon-canada-2015 / scripts / PyAudio / pyaudio_example.py View on Github external
time_curve.setData(total_data)
    
    # calculate the FFT
    fft_data = data_sample * np.hanning(len(data_sample))
    power_spectrum = 20 * np.log10(np.abs(np.fft.rfft(fft_data))/len(fft_data))
    fft_curve.setData(power_spectrum)
    fft_plot.enableAutoRange('xy', False)
timer = QtCore.QTimer()
timer.timeout.connect(update)
timer.start(0)

## Start Qt Event
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
# stop Recording
stream.stop_stream()
stream.close()
audio.terminate()
github pyqtgraph / pyqtgraph / examples / GLSurfacePlot.py View on Github external
index = 0
def update():
    global p4, z, index
    index -= 1
    p4.setData(z=z[index%z.shape[0]])
    
timer = QtCore.QTimer()
timer.timeout.connect(update)
timer.start(30)

## Start Qt event loop unless running in interactive mode.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()