如何更改wxPython StyledTextCtrl边距的背景

问题描述 投票:0回答:1

我找到了SetMarginBackground ...但是无法使用...我是wxPython的新手。我需要在我创建的StyledTextCtrl类中使用它……在此先感谢...

以下代码在折叠保证金下工作正常...

self.SetFoldMarginHiColour(True, "#282828")

self.SetFoldMarginColour(True, "#282828")

我也需要更改边距背景颜色...请帮助我..谢谢..

Output

wxpython wxpython-phoenix
1个回答
0
投票

wx.stc.StyledTextCtrl是“原始” scintilla界面的1对1映射,其文档可以在Scintilla网站(http://www.scintilla.org/)中找到。

更改Scintilla中的页边距颜色-“处理页边距的方式(尤其是涉及到颜色的方法)非常难以理解”。有关详细信息,说明和链接,请参见https://github.com/jacobslusser/ScintillaNET/issues/220:激怒的@jacobslusser

最后,我设法从众多来源中整理了一个例子:

edwx.stc.StyledTextCtrl的地方>

# line numbers in the margin
ed.SetMarginType(1, stc.STC_MARGIN_NUMBER)
ed.SetMarginWidth(1, 25)
# Background and foreground colours
ed.StyleSetSpec(stc.STC_STYLE_DEFAULT,'fore:#000000,back:#00A100')
# Line numbers in margin colours
ed.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER,'fore:#FFFF00,back:#0000AA')

enter image description here

我只能建议您使用它。

© www.soinside.com 2019 - 2024. All rights reserved.