Spell check as you type with pyenchant

Hi all,
I am one of the maintainers of a wxpython software called wikidpad.
It implements “spell check while typing” where misspelled words get
a squiggly red underline in what essentially is a wx.stc.StyledTextCtrl.

This stopped working around wxpython 4.0.0 and I am looking for a
way to fix it. I don’t gen any squiggly red line and other formatting
disappears. The spell check dialog works fine.

Is there a fresh working example of a wxapp that implements this?
I looked up editra, but it seems abandoned.

I found it very hard to read about this anywhere. Can anyone point to

Thanks for your time!


How about this? This sample code is based on ‘/demo/StyledTextCtrl_1.py’
:memo: EditWindow is stc.StyledTextCtrl with Python lexer and some default styles.

import wx
from wx import stc
from wx.py.editwindow import EditWindow

class TestEditor(EditWindow):
    def __init__(self, *args, **kwargs):
        EditWindow.__init__(self, *args, **kwargs)
        self.IndicatorSetStyle(0, stc.STC_INDIC_SQUIGGLE)
        self.IndicatorSetForeground(0, "red")
        self.IndicatorSetAlpha(0, 0x80)
        self.IndicatorSetUnder(0, True)
        self.IndicatorSetStyle(1, stc.STC_INDIC_DIAGONAL)
        self.IndicatorSetForeground(1, "blue")
        self.IndicatorSetStyle(2, stc.STC_INDIC_STRIKE)
        self.IndicatorSetForeground(2, "red")

if __name__ == "__main__":
    app = wx.App()
    frame = mwx.Frame(None)
    ed = TestEditor(frame)
    ed.Text = "The quick brown fox jumped uber the lazy dog.\n"
    ed.IndicatorFillRange(27, 4)
    ed.IndicatorFillRange(32, 3)
    ed.IndicatorFillRange(36, 4)
    frame.ed = ed

Python 3.8.6
wx.version 4.1.1

Thank you very much!
It works for me, Ill check back when I understand how it works.