我试过(但没有任何反应)
self.txt.SetBackgroundColour ((255,0,0))
正如标题中所说,我正在尝试更改背景颜色 StyledTextCtrl。有谁知道可以使用的方法?我检查了 API 文档,但似乎找不到,http://wxpython.org/docs/api/wx.stc.StyledTextCtrl-class.html
(当然,背景颜色是指整个书写区域)
有谁知道我可以做到这一点的方法?
编辑:
以下代码中的背景没有改变
import wx
import wx.stc
app = wx.App(redirect=True)
top = wx.Frame(None, title="StyledTXTCtrl", size=(300,200))
txt=wx.stc.StyledTextCtrl(top)
txt.SetBackgroundColour((255,255,0))
txt.Refresh()
top.Show()
app.MainLoop()