First, here's where you will find documentation:
wxPython specific: http://www.yellowbrain.com/stc/index.html
another one: http://wxpython.org/docs/api/wx.stc-module.html
wxWidgets specific information: http://webpages.charter.net/edreamleo/out2.htm
Scintilla documentation (not directly useful, since it all is wrapped): http://scintilla.sourceforge.net/ScintillaDoc.html
Also look at wxStyledTextCtrl.
- You must set a face property for other font-related properties to take effect. Without a face property, the style will inherit the font from the default property and size, bold, and italic will not be applied (underline, however, will). When you *do* set a face property, the other font properties are not inherited from default. So if you just want to add bold to a style, for example, you must also have face, italic, and size properties matching the default style.
Here is some misc. notes from RichardPrescott
Calls to StartStyling and SetStyling within an EVT_STC_MODIFIED when SetLexer(wxSTC_LEX_CONTAINER) doesn't work with wxPython 2.4 for Python 2.3. Although within EVT_STC_STYLENEEDED (as it is supposed to be) it works just fine.
Events from EVT_STC_STYLENEEDED seem to provide only GetPosition() which correspond to the position at the end of the modification. It is up to the code to find out what is already styled, what is not and what styled need to be refreshed.
Here's an example how to find the area to be styled:
1 def onStyleNeeded(self, e): 2 start = self.GetEndStyled() # this is the first character that needs styling 3 end = e.GetPosition() # this is the last character that needs styling 4 self.StartStyling(start, 31) # in this example, only style the text style bits 5 for pos in range(start, end): # in this example, simply loop over it.. 6 self.SetStyling(1, NUMBER) # ..and set it all to the NUMBER style
Here is some misc. notes from Francesco
* You can control what types of modifications will fire a EVT_STC_MODIFIED event with the SetModEventMask command.
Not documented in Stc Documentation at: www.yellowbrain.com/stc/index.html:
* CopyRange(4, 8) #copies text from pos1 (4) until pos2 (8) into clipboard
* CopyText(4, "abcd") #copies text ("abcd") into clipboard
There is a long standing bug in the wxPython code which prevents the X11 clipboard (middle mouse copy/paste) from working with STC controls. You can paste into them, but never can paste out of them. Even if you use wx.TheClipboard.UsePrimary() - it will have no effect at all in wxPython. C++ code using the STC is not affected by this and it works properly.
Normal copy/paste (using the second X11 clipboard) is not affected by this and works fine, i.e. you can use ctrl-C/ctrl-V to copy/paste between STC and other apps.
The above link is a bug filed by Robin Dunn himself several years ago.. and apparently still open. Oh well.
This is fixed as of (at least) 2.8.4.