(newbie) Textctrl to string?

Sorry for the newbie-ness of this post, but I'm working my
way through the moinmoin tutorials and a challenge.

I'm currently working on getting my text editor to save the
textctrl content to a file. Currently, I try and create a
string from the textctrl element:

writestring = str(self.control)
However, this produces some wierd text - it looks like a
text representation of the textctrl.

What is the best way of extracting a string out of a
textctrl window?

Thanks
adam

Hi,
I my self do it by

def OnSaveAs(self,e):
        """Save as"""
        dlg=wx.FileDialog(self,"Save the file",".","","Text Files (*.txt)
*.txt|All Files|*.*",wx.SAVE|wx.OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            self.fileName=dlg.GetPath()
            f=codecs.open(self.fileName,'w','utf-8')
            text = self.control.GetValue()
           f.write(text)
            
            f.close
        dlg.Destroy()

···

On Saturday 01 of May 2004 18:18, Adam wrote:

Sorry for the newbie-ness of this post, but I'm working my
way through the moinmoin tutorials and a challenge.

I'm currently working on getting my text editor to save the
textctrl content to a file. Currently, I try and create a
string from the textctrl element:

writestring = str(self.control)
However, this produces some wierd text - it looks like a
text representation of the textctrl.

What is the best way of extracting a string out of a
textctrl window?

Thanks
adam

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

You want to use self.control.GetValue(). See the wxTextCtrl page of the wxWidgets documentation that came with wxPython for a full list of methods.

ka

···

On May 1, 2004, at 9:18 AM, Adam wrote:

Sorry for the newbie-ness of this post, but I'm working my
way through the moinmoin tutorials and a challenge.

I'm currently working on getting my text editor to save the
textctrl content to a file. Currently, I try and create a
string from the textctrl element:

writestring = str(self.control)
However, this produces some wierd text - it looks like a
text representation of the textctrl.

What is the best way of extracting a string out of a
textctrl window?

Thanks
adam