您应该在使用之前定义标记样式。这是代码:
class SimplePythonEditor(QsciScintilla):
CIRCLE_MARKER_NUM = 0
......
def __init__(self, parent=None):
super(SimplePythonEditor, self).__init__(parent)
self.markerDefine(QsciScintilla.Circle,self.CIRCLE_MARKER_NUM)
self.setMarkerBackgroundColor(QColor(66, 66, 255),self.CIRCLE_MARKER_NUM)
......
def on_margin_clicked(self, nmargin, nline, modifiers):
# Toggle marker for the line the margin was clicked on
if self.markersAtLine(nline) != 0:
self.markerDelete(nline, self.CIRCLE_MARKER_NUM)
else:
self.markerAdd(nline, self.CIRCLE_MARKER_NUM)
更多细节可以修改eli的demo。
eli 的 qscintilla 演示