I'm learning python and wxPython at the same time... :) So, I have a set of python files that run fine from the command line: ./scan -d test ~/Pictures
-- for instance will create a database of my pictures called "test."
I've been working diligently on a front end for this (I didn't write the original command line python files), and I can get it to run using:
def bt_ScanUpdateClick(self, event):
self.SetSizeWH(450,360)
## DEBUG
self.tc_MainDatabase.Value = "test.db"
if self.tc_MainDatabase.Value == "":
self.LogWindow.Value += "ERROR:\tNo database name selected!\n"
else:
scanCMD = "./scan -d " + self.tc_MainDatabase.Value + " "
numLines=0
maxLines=(int(self.multiText.GetNumberOfLines()))
if self.multiText.GetLineText(numLines) == "":
self.LogWindow.Value += "ERROR\tNo folder selected to scan!\n"
else:
self.LogWindow.Value += "Running Scan...\n\n"
while (numLines < maxLines):
scanCMD += str(self.multiText.GetLineText(numLines)) + " "
numLines += 1
self.LogWindow.Value += scanCMD
p = subprocess.Popen([scanCMD],shell=True,stdout=subprocess.PIPE,stdin=subprocess.PIPE)
self.LogWindow.Value += p.communicate()[0]
This presents a problem for me:
- Once I click the Button to activate this, it doesn't actually even get to the self.SetSizeWH(450,360) part of the function. It just stays in a "down" state. When the command is done, the app comes back to life with everything in the output window (self.LogView) already... I would like to get the output in a more 'realtime' way... possible?
Any thoughts?