1

I want to make my margin look like this:-
margin design pyqt4

and i have made like this till now:-
Margin design by user

with the following code:-

self.setMarginType(1,Qsci.QsciScintilla.NumberMargin)
self.setMarginWidth(1,40)
self.setMarginsForegroundColor(QtGui.QColor(120, 128, 120))
self.setMarginLineNumbers(1,True)

Please tell is there any mistake in this code, and what code should be added to display markers or margin containing markers(like blue dots at right side of numbers.)

rock
  • 167
  • 9

1 Answers1

1

you should define the marker style before you use it. here is the code :

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)

for more details, you can modify eli's demo. eli's qscintilla demo

dameng
  • 508
  • 7
  • 12
  • can u tell me why marker number is used and how from 1 to 31 marker numbers are different from each other – rock Apr 13 '14 at 16:46
  • And How to add a custom marker symbol like with gradient,Pix map or an image etc. – rock Apr 13 '14 at 17:53