You need to unindent the line "self.txtEditor.SetText(contents)" by one level.
Paul Probert
···
tom.russell@transport.alstom.com wrote:
Apparently it's not picking up anything so I tried this:
try:
if dlg.ShowModal() == wxID_OK:
f = open(fileName, 'r')
contents = f.readlines()
f.close()
if len(contents) == 0:
contents = [""]
self.txtEditor.SetText(contents) finally:
dlg.Destroy()