f = open(os.path.join(self.dirname,self.filename),'w')
self.text2.SetValue(f.write())
f.close()
What are you trying to do here? You write nothing to the file you just opened, then set self.text2 to the return value of f.write().
f = open(os.path.join(self.dirname,self.filename),'w')
f.write(self.text2.SetValue(str(self.text2)))
f.close()
Similarily, what are you trying to do here? You're writing to the data file the return from the method "SetValue", which is NULL. That makes no sense to me.
Presumably... you would want this instead:
f = open(os.path.join(self.dirname,self.filename),'w')
f.write(self.text2.GetValue())
f.close()
Why were you trying to set self.text2 to the value of itself anyways?