Skip to content

Instantly share code, notes, and snippets.

@shurru
Last active August 29, 2015 14:17
Show Gist options
  • Save shurru/889897b237b5d41d927e to your computer and use it in GitHub Desktop.
Save shurru/889897b237b5d41d927e to your computer and use it in GitHub Desktop.
import gui_main
import sys
import numpy
from PyQt4 import QtCore, QtGui
import PyQt4.Qwt5 as Qwt
import matplotlib
import serial
import threading
global readervar
def reader():
readervar= True
ser = serial.Serial(7) #insert COM port number from which data is being collected
ser.baudrate = 9600 #insert baud rate
while True:
if readervar:
line= ser.readline()
print (line)
print(readervar)
else if uiplot.btn2.clicked():
break
readervar=False
def shutter():
readervar=False
def main():
global uiplot
app = QtGui.QApplication(sys.argv)
win_plot = gui_main.QtGui.QMainWindow()
uiplot = gui_main.Ui_Form()
uiplot.setupUi(win_plot)
uiplot.btn1.clicked.connect(reader)
uiplot.btn2.clicked.connect(shutter)
# DISPLAY WINDOWS
win_plot.show()
code = app.exec_()
sys.exit(code)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment