Ok, I'm getting somewhere here I think. Here's what I am using now:
Code:
def ChooseFile():
"""You can find documentation for CreateFileDialog at the following site:
http://aspn.activestate.com/ASPN/docs/ActivePython/2.5/pywin32/win32ui__CreateFileDialog_meth.html"""
parent = win32ui.CreateWindowFromHandle(viz.window.getHandle())
dlg = win32ui.CreateFileDialog(1,'','',0,'',parent)
if dlg.DoModal() == win32con.IDOK:
file = dlg.GetFileName()
inFileName = dlg.GetPathName()
print file
print inFileName
- Thanks farshi
However, what I would really like to do is open the selected file, so I tried adding:
Code:
FILE = open(file, 'r')
for line in FILE:
print line
- but all I get is
So my question is - what am I doing wrong here, I just want a participant to be able to select a file which is then read in / parsed into useful chunks of data.
Also when exiting winviz after running this I get a - "winviz.exe has encountered a problem and needs to close. We are sorry for the inconvenience." from windoze