我想锁定我的wx.stc.StyledTextCtrl,并且不允许对其进行写入。有人知道可以做到这一点的功能吗?类似于messagetxt.Lock()
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()
使用SetReadOnly(True)
是一种方法,如:
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")
messageTxt.SetText("This styled text is read only")
messageTxt.SetReadOnly(True)
app.SetTopWindow(frame)
app.MainLoop()