I have the following python code:
Code:
import re
import sys
prt = raw_input("Enter file to open: ")
all_the_data = open(prt,'rb').read()
pattern = 'title="(.*?)".*?value="(.*?)"'
rx = re.compile(pattern, re.IGNORECASE|re.MULTILINE|re.DOTALL)
result = rx.findall(all_the_data)
for title, value in result:
print '%-25s: %s' %(title, value)
I want the code to be used when someone picks a file with the open dialog as such displaying the results to my text box "textEditor":
Code:
def OnMenuFileOpenMenu(self, event):
dlg = wx.FileDialog(self, "Choose a file", ".", "", "*.prt", wx.OPEN)
try:
if dlg.ShowModal() == wx.ID_OK:
filename = dlg.GetPath()
self.textEditor.LoadFile(filename)
self.FileName=filename
self.SetTitle(('DCS File Log Viewer- %s') % filename)
# process the file
finally:
dlg.Destroy()
The question is how do I do it? I have been unable to find any good examples thus far. I am using BOA for my development. Thanks!