How to set wxTextCtrl style to wxHSCROLL?

Tim timblack1 at yahoo.com
Sat Aug 21 01:31:44 EDT 2004


How can I set the style attribute in the following wxTextCtrl to a new
style AFTER I have already instantiated the wxTextCtrl?  I'm trying to
toggle the word wrap attribute of the wxTextCtrl, just like Edit->Word
Wrap does in Windows Notepad.  (I'm building a Windows Notepad clone
in wxPython to prove to a VB friend that it can be done.)

Here is the wxTextCtrl instantiation:

--------------
    self.txtEditor = wxTextCtrl(id=wxID_WXFRAME1TXTEDITOR,
name='txtEditor',
        parent=self, pos=wxPoint(0, 0), size=wxSize(760, 492),
        style=wxTE_MULTILINE, value='')
--------------

Here is the code I've tried to set the style to a new value:

--------------
    def OnMnuEditWordwrapMenu(self, event):
        # TODO: implement word wrap
        self.txtEditor.SetStyle(0, self.txtEditor.GetLastPosition(),
wxHSCROLL)
        #self.txtEditor.style = 'wxHSCROLL'

--------------

What is the correct syntax?

Thanks!

Tim



More information about the Python-list mailing list