pythonwxpythonwxwidgetstextctrlwxstyledtextctrl

What is the easiest way to make StyledTextCtrl look like a TextCtrl?


The only additional features I need from StyledTextCtrl are the following:

  1. Change caret width using SetCaretWidth(pixels)
  2. Change caret colour using self.SetCaretForeground(colour)
  3. Change entire background colour to transparent (or alpha). I don't know how to do this.
  4. Change Font (face and size). I don't know this either.

Other than that I want it to behave exactly like a normal TextCtrl. ie. No scrollbars, no multilines etc. A lot of info here, but it is overwhelmingly big! So how much code will I have to write before I shoot myself in the foot?


There's a sample model here, for quick testing.


Solution

  • You can do (4) with a plain wxTextCtrl without any problems, so if you can live with just this, I'd strongly suggest just using the standard control instead. You can make the window transparent but this is not implemented in all ports (notably not in wxMSW) currently. The other two points are extremely unlikely to be ever possible with the standard control as it's really supposed to use the standard caret.

    If you really need (1) and (2) you will have to use the non-native wxStyledTextCtrl but then you really should abandon any idea to make it behave exactly like the native control, it won't work.