Hi All,

I am a beginner in python and have just started using it a couple weeks ago.
I am using python 3.4.3 on windows 7 machine together with IDLE 3.4.3 for 
compiling a code.
The following steps are:

I have a program, called PyAquire, such as:

import PyAquireUi
import sys
from PySide import QtGui
import PyAquireMain

def main():
    master = PyAquireMain.PyAquireMain()
    app = QtGui.QApplication(sys.argv)
    ex = PyAquireUi.PyAquireMainWindow(master)
    sys.exit(app.exec_())



if __name__ == '__main__':
    main()

which opens a new window, where by clicking  RUN/STOP button, program acquires 
data. The data is running in the window.
Program runs in the background, acquiring data all the time and
my task is to write a code, where I will be able

a)      to connect with this program without interrupting the process

b)      capture the current available data

c)       and save data to excel file.

The code I have written is:

import PyAquireMain

def main():
    obj = PyAquireMain.PyAquireMain()# Create instance obj
       obj.saveSweepData()# call the method from PyAquireMain to save the file


if __name__ == '__main__':
    main()


saveSweepData function from PyAquireMain is:
   def saveSweepData(self):
        fileSuffix = 
QtCore.QDateTime.currentDateTime().toString('yyyy-MM-dd_hh.mm.ss')
        fileType = '.csv' # was .txt
        if self.ch1.yData is not None:
            saveFileName = 'data' + fileSuffix + fileType
            with open(os.path.join(self.settings.saveDir,saveFileName),'wb') as 
f:
                #    f.writelines(header)
                    np.savetxt(f,self.ch1.yData,fmt='%d',delimiter='\n')


Therefore the question is how can I access the PyAquireMain, capture data and 
save file simultaneously when other program is running in the background.


Thanks,
Patrycja

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to