I want to lock my wx.stc.StyledTextCtrl and to not allow writing into it. Someone knows a function that can do that? something like messagetxt.Lock() In addition, I want to add text where the insertion point, from the code when it is in ReadOnly
import wx
from wx.stc import StyledTextCtrl`
app = wx.App()
frame = wx.Frame(None, -1, title='2', pos=(0, 0), size=(500, 500))
frame.Show(True)
messageTxt = StyledTextCtrl(frame, id=wx.ID_ANY, pos=(0, 0), size=(100 * 3, 100),
style=wx.TE_MULTILINE, name="File")
app.SetTopWindow(frame)
app.MainLoop()
Use
SetReadOnly(True)
is one way,as in:
Edit: Toggling the
SetReadOnly
flag will allow the program to alter the text, rather than the user.i.e.: