I run a long excel VBA macro (about 10-15 minutes) from a python script. I would like to make a progressbar for the end users. In order to communicate from the macro to the python script, I tried to write in a txt file the % of progress from the VBA macro, and plug that number to a progressBar (done with Qt) in my .py The problem is: the py scripts waits for the macro to finsih to go read the .txt file value. I am looking for a way to force Python to go to the next command without waiting for the macro to finish. Here is the .py I have used unsuccesfully
from PyQt4 import QtGui, QtCore
import sys
import progress
import win32com.client
class Progress(QtGui.QDialog, progress.Ui_Progress):
def __init__(self, parent=None):
super(Progress, self).__init__(parent)
self.setupUi(self)
self.progressBar.setValue(0)
def main(self):
self.show()
def evolution(self, a):
self.progressBar.setValue(a)
if __name__=='__main__':
app = QtGui.QApplication(sys.argv)
progress = Progress()
progress.main()
xl=win32com.client.Dispatch("Excel.Application")
xl.Workbooks.Open(Filename="filename",ReadOnly=1)
xl.Application.ScreenUpdating = False
xl.Application.Run("myscript")
while a < 100
file = open('newfile.txt', 'r')
a = int(file.read())
progress.evolution(a)
file.close()
app.exec_()
def main():
pass