在Stani Python Editor中更改空白颜色

时间:2011-02-27 21:54:28

标签: python ide

我想出了如何编辑SPE颜色的外观。一切正常,除非我尝试更改空白颜色:空白仍然是白色。下面是一个代码片段,显示了空白背景的值输入。如何更改空白颜色?

# Global default styles for all languages
            self.StyleSetSpec(wx_stc.STC_STYLE_DEFAULT,     "face:%(mono)s,size:%(size)d" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_LINENUMBER,  "back:#C0C0C0,face:%(mono)s,size:%(size)d" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_CONTROLCHAR, "face:%(mono)s" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
            self.StyleSetSpec(wx_stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")

            # Python styles
            # White space
            self.StyleSetSpec(wx_stc.STC_P_DEFAULT, "face:%(mono)s, back:#3366CC, size:%(size)d" % self.faces)
            # Comment
            self.StyleSetSpec(wx_stc.STC_P_COMMENTLINE, "face:%(mono)s,fore:#330099,back:#C0C0C0,italic,size:%(size)d" % self.faces)
            # Number
            self.StyleSetSpec(wx_stc.STC_P_NUMBER, "face:%(mono)s,fore:#00CC00,size:%(size)d" % self.faces)
            # String
            self.StyleSetSpec(wx_stc.STC_P_STRING, "face:%(mono)s,fore:#3399FF,size:%(size)d" % self.faces)
            # Single quoted string
            self.StyleSetSpec(wx_stc.STC_P_CHARACTER, "face:%(mono)s,fore:#7F007F,size:%(size)d" % self.faces)
            # Keyword
            self.StyleSetSpec(wx_stc.STC_P_WORD, "face:%(mono)s,fore:#339900,bold,size:%(size)d" % self.faces)
            # Triple quotes
            self.StyleSetSpec(wx_stc.STC_P_TRIPLE, "face:%(mono)s,fore:#FF3300,size:%(size)d" % self.faces)
            # Triple double quotes
            self.StyleSetSpec(wx_stc.STC_P_TRIPLEDOUBLE, "face:%(mono)s,fore:#7F0000,size:%(size)d" % self.faces)
            # Class name definition
            self.StyleSetSpec(wx_stc.STC_P_CLASSNAME, "face:%(mono)s,fore:#0000FF,bold,underline,size:%(size)d" % self.faces)
            # Function or method name definition
            self.StyleSetSpec(wx_stc.STC_P_DEFNAME, "face:%(mono)s,fore:#0066CC,bold,size:%(size)d" % self.faces)
            # Operators
            self.StyleSetSpec(wx_stc.STC_P_OPERATOR, "face:%(mono)s,bold,size:%(size)d" % self.faces)
            # Identifiers
            self.StyleSetSpec(wx_stc.STC_P_IDENTIFIER, "")
            # Comment-blocks
            self.StyleSetSpec(wx_stc.STC_P_COMMENTBLOCK, "face:%(mono)s,fore:#003300,back:#C0C0C0,italic,size:%(size)d" % self.faces)
            # End of line where string is not closed
            self.StyleSetSpec(wx_stc.STC_P_STRINGEOL, "face:%(mono)s,fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % self.faces)

1 个答案:

答案 0 :(得分:0)

注释:如果将数据和代码分开,可能更容易阅读配置:

settings = [
 "STYLE_DEFAULT", "face:%(mono)s,size:%(size)d",
 "STYLE_LINENUMBER",  "back:#C0C0C0,face:%(mono)s,size:%(size)d",
 ...
 "P_COMMENTBLOCK", "face:%(mono)s,fore:#003300,back:#C0C0C0,italic,size:%(size)d",
 "P_STRINGEOL", "face:%(mono)s,fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d",
]

for name, value in zip(*[iter(settings)]*2):
    self.StyleSetSpec(getattr(wx_stc, "STC_"+name), value % self.faces)