pyMez.Code.FrontEnds.StyledTextCtrlPanel API documentation

Top

# pyMez.Code.FrontEnds.StyledTextCtrlPanel module

Show source ≡

    #Boa:FramePanel:StyledTextCtrlPanel

    import wx
    import wx.stc

    [wxID_STYLEDTEXTCTRLPANEL, wxID_STYLEDTEXTCTRLPANELSTYLEDTEXTCTRL1,
    ] = [wx.NewId() for _init_ctrls in range(2)]

    import  keyword

    import  wx
    import  wx.stc  as  stc

    #import  images #I don't where this module really is.  I have just replaced the ref

    #----------------------------------------------------------------------

    demoText = """\
    ## This version of the editor has been set up to edit Python source
    ## code.  Here is a copy of wxPython/demo/Main.py to play with.

    """

    #----------------------------------------------------------------------

    if wx.Platform == '__WXMSW__':
        faces = { 'times': 'Times New Roman',
                  'mono' : 'Courier New',
                  'helv' : 'Arial',
                  'other': 'Comic Sans MS',
                  'size' : 10,
                  'size2': 8,
                 }
    elif wx.Platform == '__WXMAC__':
        faces = { 'times': 'Times New Roman',
                  'mono' : 'Monaco',
                  'helv' : 'Arial',
                  'other': 'Comic Sans MS',
                  'size' : 12,
                  'size2': 10,
                 }
    else:
        faces = { 'times': 'Times',
                  'mono' : 'Courier',
                  'helv' : 'Helvetica',
                  'other': 'new century schoolbook',
                  'size' : 12,
                  'size2': 10,
                 }

    #----------------------------------------------------------------------

    class PythonSTC(stc.StyledTextCtrl):

        fold_symbols = 2

        def __init__(self, parent, id,
                     pos=wx.DefaultPosition, size=wx.DefaultSize,
                     style=0,name=None):
            stc.StyledTextCtrl.__init__(self, parent, id, pos, size, style,name)

            self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
            self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)

            self.SetLexer(stc.STC_LEX_PYTHON)
            self.SetKeyWords(0, " ".join(keyword.kwlist))

            self.SetProperty("fold", "1")
            self.SetProperty("tab.timmy.whinge.level", "1")
            self.SetMargins(0,0)

            self.SetViewWhiteSpace(False)
            #self.SetBufferedDraw(False)
            #self.SetViewEOL(True)
            #self.SetEOLMode(stc.STC_EOL_CRLF)
            #self.SetUseAntiAliasing(True)

            self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
            self.SetEdgeColumn(78)

            # Setup a margin to hold fold markers
            self.SetFoldFlags(16)  ###  WHAT IS THIS VALUE?  WHAT ARE THE OTHER FLAGS?  DOES IT MATTER?
            self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
            self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
            self.SetMarginSensitive(2, True)
            self.SetMarginWidth(2, 12)

            if self.fold_symbols == 0:
                # Arrow pointing right for contracted folders, arrow pointing down for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_ARROWDOWN, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_ARROW, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,     "white", "black")

            elif self.fold_symbols == 1:
                # Plus for contracted folders, minus for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_MINUS, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_PLUS,  "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")

            elif self.fold_symbols == 2:
                # Like a flattened tree control using circular headers and curved joins
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_CIRCLEMINUS,          "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_CIRCLEPLUS,           "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,                "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNERCURVE,         "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_CIRCLEPLUSCONNECTED,  "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE,         "white", "#404040")

            elif self.fold_symbols == 3:
                # Like a flattened tree control using square headers
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_BOXMINUS,          "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_BOXPLUS,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,             "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNER,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_BOXPLUSCONNECTED,  "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,           "white", "#808080")

            self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
            self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
            self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)

            # Make some styles,  The lexer defines what each style is used for, we
            # just have to define what each style looks like.  This set is adapted from
            # Scintilla sample property files.

            # Global default styles for all languages
            self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
            self.StyleClearAll()  # Reset all to be like the default

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

            # Python styles
            # Default
            self.StyleSetSpec(stc.STC_P_DEFAULT, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comments
            self.StyleSetSpec(stc.STC_P_COMMENTLINE, "fore:#007F00,face:%(other)s,size:%(size)d" % faces)
            # Number
            self.StyleSetSpec(stc.STC_P_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
            # String
            self.StyleSetSpec(stc.STC_P_STRING, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Single quoted string
            self.StyleSetSpec(stc.STC_P_CHARACTER, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Keyword
            self.StyleSetSpec(stc.STC_P_WORD, "fore:#00007F,bold,size:%(size)d" % faces)
            # Triple quotes
            self.StyleSetSpec(stc.STC_P_TRIPLE, "fore:#7F0000,size:%(size)d" % faces)
            # Triple double quotes
            self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, "fore:#7F0000,size:%(size)d" % faces)
            # Class name definition
            self.StyleSetSpec(stc.STC_P_CLASSNAME, "fore:#0000FF,bold,underline,size:%(size)d" % faces)
            # Function or method name definition
            self.StyleSetSpec(stc.STC_P_DEFNAME, "fore:#007F7F,bold,size:%(size)d" % faces)
            # Operators
            self.StyleSetSpec(stc.STC_P_OPERATOR, "bold,size:%(size)d" % faces)
            # Identifiers
            self.StyleSetSpec(stc.STC_P_IDENTIFIER, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comment-blocks
            self.StyleSetSpec(stc.STC_P_COMMENTBLOCK, "fore:#7F7F7F,size:%(size)d" % faces)
            # End of line where string is not closed
            #self.StyleSetSpec(stc.STC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % faces)

            self.SetCaretForeground("BLUE")

            # register some images for use in the AutoComplete box.
            self.RegisterImage(1, wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(2,
                wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(3,
                wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16)))

        def OnKeyPressed(self, event):
            if self.CallTipActive():
                self.CallTipCancel()
            key = event.GetKeyCode()

            if key == 32 and event.ControlDown():
                pos = self.GetCurrentPos()

                # Tips
                if event.ShiftDown():
                    self.CallTipSetBackground("yellow")
                    self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n'
                                     'show some suff, maybe parameters..\n\n'
                                     'fubar(param1, param2)')
                # Code completion
                else:
                    #lst = []
                    #for x in range(50000):
                    #    lst.append('%05d' % x)
                    #st = " ".join(lst)
                    #print len(st)
                    #self.AutoCompShow(0, st)

                    kw = keyword.kwlist[:]
                    kw.append("zzzzzz?2")
                    kw.append("aaaaa?2")
                    kw.append("__init__?3")
                    kw.append("zzaaaaa?2")
                    kw.append("zzbaaaa?2")
                    kw.append("this_is_a_longer_value")
                    #kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")

                    kw.sort()  # Python sorts are case sensitive
                    self.AutoCompSetIgnoreCase(False)  # so this needs to match

                    # Images are specified with a appended "?type"
                    for i in range(len(kw)):
                        if kw[i] in keyword.kwlist:
                            kw[i] = kw[i] + "?1"

                    self.AutoCompShow(0, " ".join(kw))
            else:
                event.Skip()

        def OnUpdateUI(self, evt):
            # check for matching braces
            braceAtCaret = -1
            braceOpposite = -1
            charBefore = None
            caretPos = self.GetCurrentPos()

            if caretPos > 0:
                charBefore = self.GetCharAt(caretPos - 1)
                styleBefore = self.GetStyleAt(caretPos - 1)

            # check before
            if charBefore and chr(charBefore) in "[]{}()" and styleBefore == stc.STC_P_OPERATOR:
                braceAtCaret = caretPos - 1

            # check after
            if braceAtCaret < 0:
                charAfter = self.GetCharAt(caretPos)
                styleAfter = self.GetStyleAt(caretPos)

                if charAfter and chr(charAfter) in "[]{}()" and styleAfter == stc.STC_P_OPERATOR:
                    braceAtCaret = caretPos

            if braceAtCaret >= 0:
                braceOpposite = self.BraceMatch(braceAtCaret)

            if braceAtCaret != -1  and braceOpposite == -1:
                self.BraceBadLight(braceAtCaret)
            else:
                self.BraceHighlight(braceAtCaret, braceOpposite)
                #pt = self.PointFromPosition(braceOpposite)
                #self.Refresh(True, wxRect(pt.x, pt.y, 5,5))
                #print pt
                #self.Refresh(False)

        def OnMarginClick(self, evt):
            # fold and unfold as needed
            if evt.GetMargin() == 2:
                if evt.GetShift() and evt.GetControl():
                    self.FoldAll()
                else:
                    lineClicked = self.LineFromPosition(evt.GetPosition())

                    if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG:
                        if evt.GetShift():
                            self.SetFoldExpanded(lineClicked, True)
                            self.Expand(lineClicked, True, True, 1)
                        elif evt.GetControl():
                            if self.GetFoldExpanded(lineClicked):
                                self.SetFoldExpanded(lineClicked, False)
                                self.Expand(lineClicked, False, True, 0)
                            else:
                                self.SetFoldExpanded(lineClicked, True)
                                self.Expand(lineClicked, True, True, 100)
                        else:
                            self.ToggleFold(lineClicked)

        def FoldAll(self):
            lineCount = self.GetLineCount()
            expanding = True

            # find out if we are folding or unfolding
            for lineNum in range(lineCount):
                if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
                    expanding = not self.GetFoldExpanded(lineNum)
                    break

            lineNum = 0

            while lineNum < lineCount:
                level = self.GetFoldLevel(lineNum)
                if level & stc.STC_FOLDLEVELHEADERFLAG and \
                   (level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE:

                    if expanding:
                        self.SetFoldExpanded(lineNum, True)
                        lineNum = self.Expand(lineNum, True)
                        lineNum = lineNum - 1
                    else:
                        lastChild = self.GetLastChild(lineNum, -1)
                        self.SetFoldExpanded(lineNum, False)

                        if lastChild > lineNum:
                            self.HideLines(lineNum+1, lastChild)

                lineNum = lineNum + 1

        def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
            lastChild = self.GetLastChild(line, level)
            line = line + 1

            while line <= lastChild:
                if force:
                    if visLevels > 0:
                        self.ShowLines(line, line)
                    else:
                        self.HideLines(line, line)
                else:
                    if doExpand:
                        self.ShowLines(line, line)

                if level == -1:
                    level = self.GetFoldLevel(line)

                if level & stc.STC_FOLDLEVELHEADERFLAG:
                    if force:
                        if visLevels > 1:
                            self.SetFoldExpanded(line, True)
                        else:
                            self.SetFoldExpanded(line, False)

                        line = self.Expand(line, doExpand, force, visLevels-1)

                    else:
                        if doExpand and self.GetFoldExpanded(line):
                            line = self.Expand(line, True, force, visLevels-1)
                        else:
                            line = self.Expand(line, False, force, visLevels-1)
                else:
                    line = line + 1

            return line

    #----------------------------------------------------------------------

    _USE_PANEL = 1

    def runTest(frame, nb, log):
        if not _USE_PANEL:
            ed = p = PythonSTC(nb, -1)
        else:
            p = wx.Panel(nb, -1, style = wx.NO_FULL_REPAINT_ON_RESIZE)
            ed = PythonSTC(p, -1)
            s = wx.BoxSizer(wx.HORIZONTAL)
            s.Add(ed, 1, wx.EXPAND)
            p.SetSizer(s)
            p.SetAutoLayout(True)

        ed.SetText(demoText + open('Main.py').read())
        ed.EmptyUndoBuffer()
        ed.Colourise(0, -1)

        # line numbers in the margin
        ed.SetMarginType(1, stc.STC_MARGIN_NUMBER)
        ed.SetMarginWidth(1, 25)

        return p

    #----------------------------------------------------------------------

    overview = """\
    <html><body>
    Once again, no docs yet.  <b>Sorry.</b>  But <a href="data/stc.h.html">this</a>
    and <a href="http://www.scintilla.org/ScintillaDoc.html">this</a> should
    be helpful.
    </body><html>
    """

    class XMLSTC(stc.StyledTextCtrl):
        """ This is a modified StyledTextCtrl for xml. It has weirdness because it was adpated from
        a Python STC in wx examples."""
        fold_symbols = 2

        def __init__(self, parent, id,
                     pos=wx.DefaultPosition, size=wx.DefaultSize,
                     style=0,name=None):
            stc.StyledTextCtrl.__init__(self, parent, id, pos, size, style,name)

            self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
            self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)

            self.SetLexer(stc.STC_LEX_XML)
            #self.SetKeyWords(0, " ".join(keyword.kwlist))

            self.SetProperty("fold", "1")
            self.SetProperty("tab.timmy.whinge.level", "1")
            self.SetMargins(0,0)

            #self.SetViewWhiteSpace(False)
            #self.SetBufferedDraw(False)
            #self.SetViewEOL(True)
            #self.SetEOLMode(stc.STC_EOL_CRLF)
            #self.SetUseAntiAliasing(True)

            self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
            self.SetEdgeColumn(78)

            # Setup a margin to hold fold markers
            self.SetFoldFlags(16)  ###  WHAT IS THIS VALUE?  WHAT ARE THE OTHER FLAGS?  DOES IT MATTER?
            self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
            self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
            self.SetMarginSensitive(2, True)
            self.SetMarginWidth(2, 12)

            if self.fold_symbols == 0:
                # Arrow pointing right for contracted folders, arrow pointing down for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_ARROWDOWN, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_ARROW, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,     "white", "black")

            elif self.fold_symbols == 1:
                # Plus for contracted folders, minus for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_MINUS, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_PLUS,  "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")

            elif self.fold_symbols == 2:
                # Like a flattened tree control using circular headers and curved joins
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_CIRCLEMINUS,          "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_CIRCLEPLUS,           "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,                "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNERCURVE,         "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_CIRCLEPLUSCONNECTED,  "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE,         "white", "#404040")

            elif self.fold_symbols == 3:
                # Like a flattened tree control using square headers
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_BOXMINUS,          "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_BOXPLUS,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,             "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNER,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_BOXPLUSCONNECTED,  "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,           "white", "#808080")

            self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
            self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
            self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)

            # Make some styles,  The lexer defines what each style is used for, we
            # just have to define what each style looks like.  This set is adapted from
            # Scintilla sample property files.

            # Global default styles for all languages
            self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
            self.StyleClearAll()  # Reset all to be like the default

            # Global default styles for all languages
            self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
            self.StyleSetSpec(stc.STC_STYLE_LINENUMBER,  "back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces)
            self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(other)s" % faces)
            #self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
            #self.StyleSetSpec(stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")
    #styleidnames={wx.stc.STC_H_DEFAULT: 'Default', wx.stc.STC_H_TAG: 'Tag', wx.stc.STC_H_TAGUNKNOWN: 'Tag unknown', wx.stc.STC_H_ATTRIBUTE: 'Attribute', wx.stc.STC_H_NUMBER: 'Number', wx.stc.STC_H_DOUBLESTRING: 'Double quoted string', wx.stc.STC_H_SINGLESTRING:'Single quoted string', wx.stc.STC_H_OTHER: 'Other inside tag', wx.stc.STC_H_COMMENT: 'Comment', wx.stc.STC_H_ENTITY: 'Entity', wx.stc.STC_H_TAGEND: 'Tag end', wx.stc.STC_H_XMLSTART: 'XML start', wx.stc.STC_H_XMLEND: 'XML End'}

    ##TOD:This is the section I have to define the styles for in order to work
    # styles=['STC_H_ASP', 'STC_H_ASPAT', 'STC_H_ATTRIBUTE', 'STC_H_ATTRIBUTEUNKNOWN',
    # 'STC_H_CDATA', 'STC_H_COMMENT', 'STC_H_DEFAULT', 'STC_H_DOUBLESTRING', 'STC_H_ENTITY',
    # 'STC_H_NUMBER', 'STC_H_OTHER', 'STC_H_QUESTION', 'STC_H_SCRIPT', 'STC_H_SGML_1ST_PARAM',
    # 'STC_H_SGML_1ST_PARAM_COMMENT', 'STC_H_SGML_BLOCK_DEFAULT', 'STC_H_SGML_COMMAND',
    #'STC_H_SGML_COMMENT', 'STC_H_SGML_DEFAULT', 'STC_H_SGML_DOUBLESTRING', 'STC_H_SGML_ENTITY',
    #'STC_H_SGML_ERROR', 'STC_H_SGML_SIMPLESTRING', 'STC_H_SGML_SPECIAL',
    #'STC_H_SINGLESTRING', 'STC_H_TAG', 'STC_H_TAGEND', 'STC_H_TAGUNKNOWN',
    #'STC_H_VALUE', 'STC_H_XCCOMMENT', 'STC_H_XMLEND', 'STC_H_XMLSTART']
            # XML styles, just taken from the above python sample

            # XML styles Mostly HTML styles
            # Default
            self.StyleSetSpec(stc.STC_H_DEFAULT, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comments
            self.StyleSetSpec(stc.STC_H_XCCOMMENT, "fore:#007F00,face:%(other)s,size:%(size)d" % faces)
            # Number
            self.StyleSetSpec(stc.STC_H_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
            # String
            self.StyleSetSpec(stc.STC_H_ATTRIBUTE, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Single quoted string
            self.StyleSetSpec(stc.STC_H_QUESTION, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Keyword
            self.StyleSetSpec(stc.STC_H_ATTRIBUTEUNKNOWN, "fore:#00007F,bold,size:%(size)d" % faces)
            # Single quotes
            self.StyleSetSpec(stc.STC_H_SINGLESTRING, "fore:#7F0000,size:%(size)d" % faces)
            # double quotes
            self.StyleSetSpec(stc.STC_H_DOUBLESTRING, "fore:#7F0000,size:%(size)d" % faces)
            # Tag name definition
            self.StyleSetSpec(stc.STC_H_TAG, "fore:#0000FF,bold,size:%(size)d" % faces)
            # UnknownTag definition
            self.StyleSetSpec(stc.STC_H_TAGUNKNOWN, "fore:#007F7F,bold,size:%(size)d" % faces)
            # Operators
            self.StyleSetSpec(stc.STC_H_XMLSTART, "bold,size:%(size)d" % faces)
            # Identifiers
            self.StyleSetSpec(stc.STC_H_CDATA, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comment-blocks
            self.StyleSetSpec(stc.STC_H_COMMENT, "fore:#7F007F,underline,size:%(size)d" % faces)
            # End of line where string is not closed
            #self.StyleSetSpec(stc.STC_H_XMLEND, "fore:#000000,face:%(mono)s,size:%(size)d" % faces)

            self.SetCaretForeground("BLUE")

            self.SetCaretForeground("BLUE")

            # register some images for use in the AutoComplete box.
            self.RegisterImage(1, wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(2,
                wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(3,
                wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16)))

        def OnKeyPressed(self, event):
            if self.CallTipActive():
                self.CallTipCancel()
            key = event.GetKeyCode()

            if key == 32 and event.ControlDown():
                pos = self.GetCurrentPos()

                # Tips
                if event.ShiftDown():
                    self.CallTipSetBackground("yellow")
                    self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n'
                                     'show some suff, maybe parameters..\n\n'
                                     'fubar(param1, param2)')
                # Code completion
                else:
                    #lst = []
                    #for x in range(50000):
                    #    lst.append('%05d' % x)
                    #st = " ".join(lst)
                    #print len(st)
                    #self.AutoCompShow(0, st)

                    kw = keyword.kwlist[:]
                    kw.append("zzzzzz?2")
                    kw.append("aaaaa?2")
                    kw.append("__init__?3")
                    kw.append("zzaaaaa?2")
                    kw.append("zzbaaaa?2")
                    kw.append("this_is_a_longer_value")
                    #kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")

                    kw.sort()  # Python sorts are case sensitive
                    self.AutoCompSetIgnoreCase(False)  # so this needs to match

                    # Images are specified with a appended "?type"
                    for i in range(len(kw)):
                        if kw[i] in keyword.kwlist:
                            kw[i] = kw[i] + "?1"

                    self.AutoCompShow(0, " ".join(kw))
            else:
                event.Skip()

        def OnUpdateUI(self, evt):
            # check for matching braces
            braceAtCaret = -1
            braceOpposite = -1
            charBefore = None
            caretPos = self.GetCurrentPos()

            if caretPos > 0:
                charBefore = self.GetCharAt(caretPos - 1)
                styleBefore = self.GetStyleAt(caretPos - 1)

            # check before
            if charBefore and chr(charBefore) in "[]{}()<>" and styleBefore == stc.STC_H_XMLSTART:
                braceAtCaret = caretPos - 1

            # check after
            if braceAtCaret < 0:
                charAfter = self.GetCharAt(caretPos)
                styleAfter = self.GetStyleAt(caretPos)

                if charAfter and chr(charAfter) in "[]{}()<>" and styleAfter == stc.STC_H_XMLEND:
                    braceAtCaret = caretPos

            if braceAtCaret >= 0:
                braceOpposite = self.BraceMatch(braceAtCaret)

            if braceAtCaret != -1  and braceOpposite == -1:
                self.BraceBadLight(braceAtCaret)
            else:
                self.BraceHighlight(braceAtCaret, braceOpposite)
                #pt = self.PointFromPosition(braceOpposite)
                #self.Refresh(True, wxRect(pt.x, pt.y, 5,5))
                #print pt
                #self.Refresh(False)

        def OnMarginClick(self, evt):
            # fold and unfold as needed
            if evt.GetMargin() == 2:
                if evt.GetShift() and evt.GetControl():
                    self.FoldAll()
                else:
                    lineClicked = self.LineFromPosition(evt.GetPosition())

                    if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG:
                        if evt.GetShift():
                            self.SetFoldExpanded(lineClicked, True)
                            self.Expand(lineClicked, True, True, 1)
                        elif evt.GetControl():
                            if self.GetFoldExpanded(lineClicked):
                                self.SetFoldExpanded(lineClicked, False)
                                self.Expand(lineClicked, False, True, 0)
                            else:
                                self.SetFoldExpanded(lineClicked, True)
                                self.Expand(lineClicked, True, True, 100)
                        else:
                            self.ToggleFold(lineClicked)

        def FoldAll(self):
            lineCount = self.GetLineCount()
            expanding = True

            # find out if we are folding or unfolding
            for lineNum in range(lineCount):
                if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
                    expanding = not self.GetFoldExpanded(lineNum)
                    break

            lineNum = 0

            while lineNum < lineCount:
                level = self.GetFoldLevel(lineNum)
                if level & stc.STC_FOLDLEVELHEADERFLAG and \
                   (level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE:

                    if expanding:
                        self.SetFoldExpanded(lineNum, True)
                        lineNum = self.Expand(lineNum, True)
                        lineNum = lineNum - 1
                    else:
                        lastChild = self.GetLastChild(lineNum, -1)
                        self.SetFoldExpanded(lineNum, False)

                        if lastChild > lineNum:
                            self.HideLines(lineNum+1, lastChild)

                lineNum = lineNum + 1

        def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
            lastChild = self.GetLastChild(line, level)
            line = line + 1

            while line <= lastChild:
                if force:
                    if visLevels > 0:
                        self.ShowLines(line, line)
                    else:
                        self.HideLines(line, line)
                else:
                    if doExpand:
                        self.ShowLines(line, line)

                if level == -1:
                    level = self.GetFoldLevel(line)

                if level & stc.STC_FOLDLEVELHEADERFLAG:
                    if force:
                        if visLevels > 1:
                            self.SetFoldExpanded(line, True)
                        else:
                            self.SetFoldExpanded(line, False)

                        line = self.Expand(line, doExpand, force, visLevels-1)

                    else:
                        if doExpand and self.GetFoldExpanded(line):
                            line = self.Expand(line, True, force, visLevels-1)
                        else:
                            line = self.Expand(line, False, force, visLevels-1)
                else:
                    line = line + 1

            return line

    #----------------------------------------------------------------------

    #----------------------------------------------------------------------
    #----------------------------------------------------------------------

    class StyledTextCtrlPanel(wx.Panel):
        _custom_classes = {'wx.stc.StyledTextCtrl': ['PythonSTC','XMLSTC']}
        def _init_coll_boxSizer1_Items(self, parent):
            # generated method, don't edit

            parent.Add(self.styledTextCtrl1, 1, border=2, flag=wx.EXPAND)

        def _init_sizers(self):
            # generated method, don't edit
            self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)

            self._init_coll_boxSizer1_Items(self.boxSizer1)

            self.SetSizer(self.boxSizer1)

        def _init_ctrls(self, prnt):
            # generated method, don't edit
            wx.Panel.__init__(self, id=wxID_STYLEDTEXTCTRLPANEL,
                  name='StyledTextCtrlPanel', parent=prnt, pos=wx.Point(519, 269),
                  size=wx.Size(589, 342), style=wx.TAB_TRAVERSAL)
            self.SetClientSize(wx.Size(573, 304))

            self.styledTextCtrl1 = XMLSTC(id=wxID_STYLEDTEXTCTRLPANELSTYLEDTEXTCTRL1,
                  name='styledTextCtrl1', parent=self, pos=wx.Point(0, 0),
                  size=wx.Size(573, 304), style=0)

            self._init_sizers()

        def __init__(self, parent, id, pos, size, style, name):
            self._init_ctrls(parent)

    def test_StyledTextCtrlPanel():
        app = wx.PySimpleApp()
        frame = wx.Frame(None,size=wx.Size(900, 800))
        panel=StyledTextCtrlPanel(id=1, name='IV Panel',
                  parent=frame, pos=wx.Point(350, 204), size=wx.Size(200, 800),
                  style=wx.TAB_TRAVERSAL)
        panel.styledTextCtrl1.SetText(demoText )
        #+ open('WaferName.xml').read()
        panel.styledTextCtrl1.EmptyUndoBuffer()
        panel.styledTextCtrl1.Colourise(0, -1)

        # line numbers in the margin
        panel.styledTextCtrl1.SetMarginType(1, stc.STC_MARGIN_NUMBER)
        panel.styledTextCtrl1.SetMarginWidth(1, 25)

        sizer=wx.BoxSizer()
        sizer.Add(panel,1,wx.EXPAND,2)
        frame.SetSizerAndFit(sizer)
        frame.SetSize(wx.Size(800, 600))
        frame.Show()

        app.MainLoop()
    if __name__ == '__main__':
        test_StyledTextCtrlPanel()

## Functions

def runTest(

frame, nb, log)

Show source ≡

    def runTest(frame, nb, log):
        if not _USE_PANEL:
            ed = p = PythonSTC(nb, -1)
        else:
            p = wx.Panel(nb, -1, style = wx.NO_FULL_REPAINT_ON_RESIZE)
            ed = PythonSTC(p, -1)
            s = wx.BoxSizer(wx.HORIZONTAL)
            s.Add(ed, 1, wx.EXPAND)
            p.SetSizer(s)
            p.SetAutoLayout(True)

        ed.SetText(demoText + open('Main.py').read())
        ed.EmptyUndoBuffer()
        ed.Colourise(0, -1)

        # line numbers in the margin
        ed.SetMarginType(1, stc.STC_MARGIN_NUMBER)
        ed.SetMarginWidth(1, 25)

        return p

def test_StyledTextCtrlPanel(

)

Show source ≡

    def test_StyledTextCtrlPanel():
        app = wx.PySimpleApp()
        frame = wx.Frame(None,size=wx.Size(900, 800))
        panel=StyledTextCtrlPanel(id=1, name='IV Panel',
                  parent=frame, pos=wx.Point(350, 204), size=wx.Size(200, 800),
                  style=wx.TAB_TRAVERSAL)
        panel.styledTextCtrl1.SetText(demoText )
        #+ open('WaferName.xml').read()
        panel.styledTextCtrl1.EmptyUndoBuffer()
        panel.styledTextCtrl1.Colourise(0, -1)

        # line numbers in the margin
        panel.styledTextCtrl1.SetMarginType(1, stc.STC_MARGIN_NUMBER)
        panel.styledTextCtrl1.SetMarginWidth(1, 25)

        sizer=wx.BoxSizer()
        sizer.Add(panel,1,wx.EXPAND,2)
        frame.SetSizerAndFit(sizer)
        frame.SetSize(wx.Size(800, 600))
        frame.Show()

        app.MainLoop()

## Classes

class PythonSTC

StyledTextCtrl(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=0, name=STCNameStr) StyledTextCtrl()

A wxWidgets implementation of the Scintilla source code editing component.

Show source ≡

    class PythonSTC(stc.StyledTextCtrl):

        fold_symbols = 2

        def __init__(self, parent, id,
                     pos=wx.DefaultPosition, size=wx.DefaultSize,
                     style=0,name=None):
            stc.StyledTextCtrl.__init__(self, parent, id, pos, size, style,name)

            self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
            self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)

            self.SetLexer(stc.STC_LEX_PYTHON)
            self.SetKeyWords(0, " ".join(keyword.kwlist))

            self.SetProperty("fold", "1")
            self.SetProperty("tab.timmy.whinge.level", "1")
            self.SetMargins(0,0)

            self.SetViewWhiteSpace(False)
            #self.SetBufferedDraw(False)
            #self.SetViewEOL(True)
            #self.SetEOLMode(stc.STC_EOL_CRLF)
            #self.SetUseAntiAliasing(True)

            self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
            self.SetEdgeColumn(78)

            # Setup a margin to hold fold markers
            self.SetFoldFlags(16)  ###  WHAT IS THIS VALUE?  WHAT ARE THE OTHER FLAGS?  DOES IT MATTER?
            self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
            self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
            self.SetMarginSensitive(2, True)
            self.SetMarginWidth(2, 12)

            if self.fold_symbols == 0:
                # Arrow pointing right for contracted folders, arrow pointing down for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_ARROWDOWN, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_ARROW, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,     "white", "black")

            elif self.fold_symbols == 1:
                # Plus for contracted folders, minus for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_MINUS, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_PLUS,  "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")

            elif self.fold_symbols == 2:
                # Like a flattened tree control using circular headers and curved joins
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_CIRCLEMINUS,          "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_CIRCLEPLUS,           "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,                "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNERCURVE,         "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_CIRCLEPLUSCONNECTED,  "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE,         "white", "#404040")

            elif self.fold_symbols == 3:
                # Like a flattened tree control using square headers
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_BOXMINUS,          "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_BOXPLUS,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,             "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNER,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_BOXPLUSCONNECTED,  "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,           "white", "#808080")

            self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
            self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
            self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)

            # Make some styles,  The lexer defines what each style is used for, we
            # just have to define what each style looks like.  This set is adapted from
            # Scintilla sample property files.

            # Global default styles for all languages
            self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
            self.StyleClearAll()  # Reset all to be like the default

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

            # Python styles
            # Default
            self.StyleSetSpec(stc.STC_P_DEFAULT, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comments
            self.StyleSetSpec(stc.STC_P_COMMENTLINE, "fore:#007F00,face:%(other)s,size:%(size)d" % faces)
            # Number
            self.StyleSetSpec(stc.STC_P_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
            # String
            self.StyleSetSpec(stc.STC_P_STRING, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Single quoted string
            self.StyleSetSpec(stc.STC_P_CHARACTER, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Keyword
            self.StyleSetSpec(stc.STC_P_WORD, "fore:#00007F,bold,size:%(size)d" % faces)
            # Triple quotes
            self.StyleSetSpec(stc.STC_P_TRIPLE, "fore:#7F0000,size:%(size)d" % faces)
            # Triple double quotes
            self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, "fore:#7F0000,size:%(size)d" % faces)
            # Class name definition
            self.StyleSetSpec(stc.STC_P_CLASSNAME, "fore:#0000FF,bold,underline,size:%(size)d" % faces)
            # Function or method name definition
            self.StyleSetSpec(stc.STC_P_DEFNAME, "fore:#007F7F,bold,size:%(size)d" % faces)
            # Operators
            self.StyleSetSpec(stc.STC_P_OPERATOR, "bold,size:%(size)d" % faces)
            # Identifiers
            self.StyleSetSpec(stc.STC_P_IDENTIFIER, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comment-blocks
            self.StyleSetSpec(stc.STC_P_COMMENTBLOCK, "fore:#7F7F7F,size:%(size)d" % faces)
            # End of line where string is not closed
            #self.StyleSetSpec(stc.STC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % faces)

            self.SetCaretForeground("BLUE")

            # register some images for use in the AutoComplete box.
            self.RegisterImage(1, wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(2,
                wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(3,
                wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16)))

        def OnKeyPressed(self, event):
            if self.CallTipActive():
                self.CallTipCancel()
            key = event.GetKeyCode()

            if key == 32 and event.ControlDown():
                pos = self.GetCurrentPos()

                # Tips
                if event.ShiftDown():
                    self.CallTipSetBackground("yellow")
                    self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n'
                                     'show some suff, maybe parameters..\n\n'
                                     'fubar(param1, param2)')
                # Code completion
                else:
                    #lst = []
                    #for x in range(50000):
                    #    lst.append('%05d' % x)
                    #st = " ".join(lst)
                    #print len(st)
                    #self.AutoCompShow(0, st)

                    kw = keyword.kwlist[:]
                    kw.append("zzzzzz?2")
                    kw.append("aaaaa?2")
                    kw.append("__init__?3")
                    kw.append("zzaaaaa?2")
                    kw.append("zzbaaaa?2")
                    kw.append("this_is_a_longer_value")
                    #kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")

                    kw.sort()  # Python sorts are case sensitive
                    self.AutoCompSetIgnoreCase(False)  # so this needs to match

                    # Images are specified with a appended "?type"
                    for i in range(len(kw)):
                        if kw[i] in keyword.kwlist:
                            kw[i] = kw[i] + "?1"

                    self.AutoCompShow(0, " ".join(kw))
            else:
                event.Skip()

        def OnUpdateUI(self, evt):
            # check for matching braces
            braceAtCaret = -1
            braceOpposite = -1
            charBefore = None
            caretPos = self.GetCurrentPos()

            if caretPos > 0:
                charBefore = self.GetCharAt(caretPos - 1)
                styleBefore = self.GetStyleAt(caretPos - 1)

            # check before
            if charBefore and chr(charBefore) in "[]{}()" and styleBefore == stc.STC_P_OPERATOR:
                braceAtCaret = caretPos - 1

            # check after
            if braceAtCaret < 0:
                charAfter = self.GetCharAt(caretPos)
                styleAfter = self.GetStyleAt(caretPos)

                if charAfter and chr(charAfter) in "[]{}()" and styleAfter == stc.STC_P_OPERATOR:
                    braceAtCaret = caretPos

            if braceAtCaret >= 0:
                braceOpposite = self.BraceMatch(braceAtCaret)

            if braceAtCaret != -1  and braceOpposite == -1:
                self.BraceBadLight(braceAtCaret)
            else:
                self.BraceHighlight(braceAtCaret, braceOpposite)
                #pt = self.PointFromPosition(braceOpposite)
                #self.Refresh(True, wxRect(pt.x, pt.y, 5,5))
                #print pt
                #self.Refresh(False)

        def OnMarginClick(self, evt):
            # fold and unfold as needed
            if evt.GetMargin() == 2:
                if evt.GetShift() and evt.GetControl():
                    self.FoldAll()
                else:
                    lineClicked = self.LineFromPosition(evt.GetPosition())

                    if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG:
                        if evt.GetShift():
                            self.SetFoldExpanded(lineClicked, True)
                            self.Expand(lineClicked, True, True, 1)
                        elif evt.GetControl():
                            if self.GetFoldExpanded(lineClicked):
                                self.SetFoldExpanded(lineClicked, False)
                                self.Expand(lineClicked, False, True, 0)
                            else:
                                self.SetFoldExpanded(lineClicked, True)
                                self.Expand(lineClicked, True, True, 100)
                        else:
                            self.ToggleFold(lineClicked)

        def FoldAll(self):
            lineCount = self.GetLineCount()
            expanding = True

            # find out if we are folding or unfolding
            for lineNum in range(lineCount):
                if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
                    expanding = not self.GetFoldExpanded(lineNum)
                    break

            lineNum = 0

            while lineNum < lineCount:
                level = self.GetFoldLevel(lineNum)
                if level & stc.STC_FOLDLEVELHEADERFLAG and \
                   (level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE:

                    if expanding:
                        self.SetFoldExpanded(lineNum, True)
                        lineNum = self.Expand(lineNum, True)
                        lineNum = lineNum - 1
                    else:
                        lastChild = self.GetLastChild(lineNum, -1)
                        self.SetFoldExpanded(lineNum, False)

                        if lastChild > lineNum:
                            self.HideLines(lineNum+1, lastChild)

                lineNum = lineNum + 1

        def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
            lastChild = self.GetLastChild(line, level)
            line = line + 1

            while line <= lastChild:
                if force:
                    if visLevels > 0:
                        self.ShowLines(line, line)
                    else:
                        self.HideLines(line, line)
                else:
                    if doExpand:
                        self.ShowLines(line, line)

                if level == -1:
                    level = self.GetFoldLevel(line)

                if level & stc.STC_FOLDLEVELHEADERFLAG:
                    if force:
                        if visLevels > 1:
                            self.SetFoldExpanded(line, True)
                        else:
                            self.SetFoldExpanded(line, False)

                        line = self.Expand(line, doExpand, force, visLevels-1)

                    else:
                        if doExpand and self.GetFoldExpanded(line):
                            line = self.Expand(line, True, force, visLevels-1)
                        else:
                            line = self.Expand(line, False, force, visLevels-1)
                else:
                    line = line + 1

            return line

### Ancestors (in MRO)

- PythonSTC
- wx._stc.StyledTextCtrl
- wx._core.Control
- wx._core.Window
- wx._core.WindowBase
- wx._core.EvtHandler
- wx._core.Object
- wx._core.Trackable
- sip.wrapper
- sip.simplewrapper
- builtins.object

### Class variables

var ChildrenRepositioningGuard

var fold_symbols

### Static methods

def __init__(

self, parent, id, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0, name=None)

Initialize self. See help(type(self)) for accurate signature.

Show source ≡

    def __init__(self, parent, id,
                 pos=wx.DefaultPosition, size=wx.DefaultSize,
                 style=0,name=None):
        stc.StyledTextCtrl.__init__(self, parent, id, pos, size, style,name)
        self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
        self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)
        self.SetLexer(stc.STC_LEX_PYTHON)
        self.SetKeyWords(0, " ".join(keyword.kwlist))
        self.SetProperty("fold", "1")
        self.SetProperty("tab.timmy.whinge.level", "1")
        self.SetMargins(0,0)
        self.SetViewWhiteSpace(False)
        #self.SetBufferedDraw(False)
        #self.SetViewEOL(True)
        #self.SetEOLMode(stc.STC_EOL_CRLF)
        #self.SetUseAntiAliasing(True)

        self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
        self.SetEdgeColumn(78)
        # Setup a margin to hold fold markers
        self.SetFoldFlags(16)  ###  WHAT IS THIS VALUE?  WHAT ARE THE OTHER FLAGS?  DOES IT MATTER?
        self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
        self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
        self.SetMarginSensitive(2, True)
        self.SetMarginWidth(2, 12)
        if self.fold_symbols == 0:
            # Arrow pointing right for contracted folders, arrow pointing down for expanded
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_ARROWDOWN, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_ARROW, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY,     "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,     "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,     "white", "black")

        elif self.fold_symbols == 1:
            # Plus for contracted folders, minus for expanded
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_MINUS, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_PLUS,  "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")
        elif self.fold_symbols == 2:
            # Like a flattened tree control using circular headers and curved joins
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_CIRCLEMINUS,          "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_CIRCLEPLUS,           "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,                "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNERCURVE,         "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_CIRCLEPLUSCONNECTED,  "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE,         "white", "#404040")
        elif self.fold_symbols == 3:
            # Like a flattened tree control using square headers
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_BOXMINUS,          "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_BOXPLUS,           "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,             "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNER,           "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_BOXPLUSCONNECTED,  "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,           "white", "#808080")
        self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
        self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)
        # Make some styles,  The lexer defines what each style is used for, we
        # just have to define what each style looks like.  This set is adapted from
        # Scintilla sample property files.
        # Global default styles for all languages
        self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
        self.StyleClearAll()  # Reset all to be like the default
        # Global default styles for all languages
        self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
        self.StyleSetSpec(stc.STC_STYLE_LINENUMBER,  "back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces)
        self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(other)s" % faces)
        self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
        self.StyleSetSpec(stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")
        # Python styles
        # Default
        self.StyleSetSpec(stc.STC_P_DEFAULT, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
        # Comments
        self.StyleSetSpec(stc.STC_P_COMMENTLINE, "fore:#007F00,face:%(other)s,size:%(size)d" % faces)
        # Number
        self.StyleSetSpec(stc.STC_P_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
        # String
        self.StyleSetSpec(stc.STC_P_STRING, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
        # Single quoted string
        self.StyleSetSpec(stc.STC_P_CHARACTER, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
        # Keyword
        self.StyleSetSpec(stc.STC_P_WORD, "fore:#00007F,bold,size:%(size)d" % faces)
        # Triple quotes
        self.StyleSetSpec(stc.STC_P_TRIPLE, "fore:#7F0000,size:%(size)d" % faces)
        # Triple double quotes
        self.StyleSetSpec(stc.STC_P_TRIPLEDOUBLE, "fore:#7F0000,size:%(size)d" % faces)
        # Class name definition
        self.StyleSetSpec(stc.STC_P_CLASSNAME, "fore:#0000FF,bold,underline,size:%(size)d" % faces)
        # Function or method name definition
        self.StyleSetSpec(stc.STC_P_DEFNAME, "fore:#007F7F,bold,size:%(size)d" % faces)
        # Operators
        self.StyleSetSpec(stc.STC_P_OPERATOR, "bold,size:%(size)d" % faces)
        # Identifiers
        self.StyleSetSpec(stc.STC_P_IDENTIFIER, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
        # Comment-blocks
        self.StyleSetSpec(stc.STC_P_COMMENTBLOCK, "fore:#7F7F7F,size:%(size)d" % faces)
        # End of line where string is not closed
        #self.StyleSetSpec(stc.STC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % faces)
        self.SetCaretForeground("BLUE")
        # register some images for use in the AutoComplete box.
        self.RegisterImage(1, wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
        self.RegisterImage(2,
            wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
        self.RegisterImage(3,
            wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16)))

def Bind(

self, event, handler, source=None, id=-1, id2=-1)

Bind an event to an event handler.

:param event: One of the `EVT_*` event binder objects that specifies the type of event to bind.

:param handler: A callable object to be invoked when the event is delivered to self. Pass `None` to disconnect an event handler.

:param source: Sometimes the event originates from a different window than self, but you still want to catch it in self. (For example, a button event delivered to a frame.) By passing the source of the event, the event handling system is able to differentiate between the same event type from different controls.

:param id: Used to spcify the event source by ID instead of instance.

:param id2: Used when it is desirable to bind a handler to a range of IDs, such as with EVT_MENU_RANGE.

Show source ≡

    def _EvtHandler_Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
        """
        Bind an event to an event handler.

        :param event: One of the ``EVT_*`` event binder objects that
                      specifies the type of event to bind.

        :param handler: A callable object to be invoked when the
                        event is delivered to self.  Pass ``None`` to
                        disconnect an event handler.

        :param source: Sometimes the event originates from a
                       different window than self, but you still
                       want to catch it in self.  (For example, a
                       button event delivered to a frame.)  By
                       passing the source of the event, the event
                       handling system is able to differentiate
                       between the same event type from different
                       controls.

        :param id: Used to spcify the event source by ID instead
                   of instance.

        :param id2: Used when it is desirable to bind a handler
                    to a range of IDs, such as with EVT_MENU_RANGE.
        """
        assert isinstance(event, wx.PyEventBinder)
        assert callable(handler) or handler is None
        assert source is None or hasattr(source, 'GetId')
        if source is not None:
            id  = source.GetId()
        event.Bind(self, id, id2, handler)

def ConvertDialogPointToPixels(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def ConvertDialogSizeToPixels(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def DLG_UNIT(

self, dlg_unit)

A convenience wrapper for :meth:`ConvertDialogToPixels`.

Show source ≡

    def _Window_DLG_UNIT(self, dlg_unit):
        """
        A convenience wrapper for :meth:`ConvertDialogToPixels`.
        """
        is_wxType = isinstance(dlg_unit, (wx.Size, wx.Point))
        pix = self.ConvertDialogToPixels(dlg_unit)
        if not is_wxType:
            pix = tuple(pix)
        return pix

def DestroyLater(

self)

Schedules the window to be destroyed in the near future.

This should be used whenever Destroy could happen too soon, such as when there may still be events for this window or its children waiting in the event queue.

Show source ≡

    def _Window_DestroyLater(self):
        """
        Schedules the window to be destroyed in the near future.

        This should be used whenever Destroy could happen too soon, such
        as when there may still be events for this window or its children
        waiting in the event queue.
        """
        self.Hide()
        wx.GetApp().ScheduleForDestruction(self)

def Expand(

self, line, doExpand, force=False, visLevels=0, level=-1)

Show source ≡

    def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
        lastChild = self.GetLastChild(line, level)
        line = line + 1
        while line <= lastChild:
            if force:
                if visLevels > 0:
                    self.ShowLines(line, line)
                else:
                    self.HideLines(line, line)
            else:
                if doExpand:
                    self.ShowLines(line, line)
            if level == -1:
                level = self.GetFoldLevel(line)
            if level & stc.STC_FOLDLEVELHEADERFLAG:
                if force:
                    if visLevels > 1:
                        self.SetFoldExpanded(line, True)
                    else:
                        self.SetFoldExpanded(line, False)
                    line = self.Expand(line, doExpand, force, visLevels-1)
                else:
                    if doExpand and self.GetFoldExpanded(line):
                        line = self.Expand(line, True, force, visLevels-1)
                    else:
                        line = self.Expand(line, False, force, visLevels-1)
            else:
                line = line + 1
        return line

def FoldAll(

self)

Show source ≡

    def FoldAll(self):
        lineCount = self.GetLineCount()
        expanding = True
        # find out if we are folding or unfolding
        for lineNum in range(lineCount):
            if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
                expanding = not self.GetFoldExpanded(lineNum)
                break
        lineNum = 0
        while lineNum < lineCount:
            level = self.GetFoldLevel(lineNum)
            if level & stc.STC_FOLDLEVELHEADERFLAG and \
               (level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE:
                if expanding:
                    self.SetFoldExpanded(lineNum, True)
                    lineNum = self.Expand(lineNum, True)
                    lineNum = lineNum - 1
                else:
                    lastChild = self.GetLastChild(lineNum, -1)
                    self.SetFoldExpanded(lineNum, False)
                    if lastChild > lineNum:
                        self.HideLines(lineNum+1, lastChild)
            lineNum = lineNum + 1

def GetPositionTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def GetSizeTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def GetVirtualSizeTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def MoveXY(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def OnKeyPressed(

self, event)

Show source ≡

    def OnKeyPressed(self, event):
        if self.CallTipActive():
            self.CallTipCancel()
        key = event.GetKeyCode()
        if key == 32 and event.ControlDown():
            pos = self.GetCurrentPos()
            # Tips
            if event.ShiftDown():
                self.CallTipSetBackground("yellow")
                self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n'
                                 'show some suff, maybe parameters..\n\n'
                                 'fubar(param1, param2)')
            # Code completion
            else:
                #lst = []
                #for x in range(50000):
                #    lst.append('%05d' % x)
                #st = " ".join(lst)
                #print len(st)
                #self.AutoCompShow(0, st)
                kw = keyword.kwlist[:]
                kw.append("zzzzzz?2")
                kw.append("aaaaa?2")
                kw.append("__init__?3")
                kw.append("zzaaaaa?2")
                kw.append("zzbaaaa?2")
                kw.append("this_is_a_longer_value")
                #kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")
                kw.sort()  # Python sorts are case sensitive
                self.AutoCompSetIgnoreCase(False)  # so this needs to match
                # Images are specified with a appended "?type"
                for i in range(len(kw)):
                    if kw[i] in keyword.kwlist:
                        kw[i] = kw[i] + "?1"
                self.AutoCompShow(0, " ".join(kw))
        else:
            event.Skip()

def OnMarginClick(

self, evt)

Show source ≡

    def OnMarginClick(self, evt):
        # fold and unfold as needed
        if evt.GetMargin() == 2:
            if evt.GetShift() and evt.GetControl():
                self.FoldAll()
            else:
                lineClicked = self.LineFromPosition(evt.GetPosition())
                if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG:
                    if evt.GetShift():
                        self.SetFoldExpanded(lineClicked, True)
                        self.Expand(lineClicked, True, True, 1)
                    elif evt.GetControl():
                        if self.GetFoldExpanded(lineClicked):
                            self.SetFoldExpanded(lineClicked, False)
                            self.Expand(lineClicked, False, True, 0)
                        else:
                            self.SetFoldExpanded(lineClicked, True)
                            self.Expand(lineClicked, True, True, 100)
                    else:
                        self.ToggleFold(lineClicked)

def OnUpdateUI(

self, evt)

Show source ≡

    def OnUpdateUI(self, evt):
        # check for matching braces
        braceAtCaret = -1
        braceOpposite = -1
        charBefore = None
        caretPos = self.GetCurrentPos()
        if caretPos > 0:
            charBefore = self.GetCharAt(caretPos - 1)
            styleBefore = self.GetStyleAt(caretPos - 1)
        # check before
        if charBefore and chr(charBefore) in "[]{}()" and styleBefore == stc.STC_P_OPERATOR:
            braceAtCaret = caretPos - 1
        # check after
        if braceAtCaret < 0:
            charAfter = self.GetCharAt(caretPos)
            styleAfter = self.GetStyleAt(caretPos)
            if charAfter and chr(charAfter) in "[]{}()" and styleAfter == stc.STC_P_OPERATOR:
                braceAtCaret = caretPos
        if braceAtCaret >= 0:
            braceOpposite = self.BraceMatch(braceAtCaret)
        if braceAtCaret != -1  and braceOpposite == -1:
            self.BraceBadLight(braceAtCaret)
        else:
            self.BraceHighlight(braceAtCaret, braceOpposite)

def PostCreate(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetClientRect(

self, rect)

Show source ≡

    def _Window_SetClientRect(self, rect):
        return self.SetClientSize(rect)

def SetDimensions(

*args, **kw)

SetDimensions(x, y, width, height, sizeFlags=SIZE_AUTO)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetRect(

self, rect)

Show source ≡

    def _Window_SetRect(self, rect):
        return self.SetSize(rect)

def SetSizeHintsSz(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetSizeWH(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetToolTipString(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetVirtualSizeWH(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def Unbind(

self, event, source=None, id=-1, id2=-1, handler=None)

Disconnects the event handler binding for event from `self`. Returns `True` if successful.

Show source ≡

    def _EvtHandler_Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None):
        """
        Disconnects the event handler binding for event from `self`.
        Returns ``True`` if successful.
        """
        if source is not None:
            id  = source.GetId()
        return event.Unbind(self, id, id2, handler)

### Instance variables

var AcceleratorTable

GetAcceleratorTable() -> AcceleratorTable

Gets the accelerator table for this window.

var AdditionalCaretForeground

GetAdditionalCaretForeground() -> Colour

Get the foreground colour of additional carets.

var AdditionalCaretsBlink

GetAdditionalCaretsBlink() -> bool

Whether additional carets will blink.

var AdditionalCaretsVisible

GetAdditionalCaretsVisible() -> bool

Whether additional carets are visible.

var AdditionalSelAlpha

GetAdditionalSelAlpha() -> int

Get the alpha of the selection.

var AdditionalSelectionTyping

GetAdditionalSelectionTyping() -> bool

Whether typing can be performed into multiple selections.

var AllLinesVisible

GetAllLinesVisible() -> bool

Are all lines visible?

var Anchor

GetAnchor() -> int

Returns the position of the opposite end of the selection to the caret.

var AutoLayout

GetAutoLayout() -> bool

Returns the sizer of which this window is a member, if any, otherwise NULL.

var BackSpaceUnIndents

GetBackSpaceUnIndents() -> bool

Does a backspace pressed when caret is within indentation unindent?

var BackgroundColour

GetBackgroundColour() -> Colour

Returns the background colour of the window.

var BackgroundStyle

GetBackgroundStyle() -> BackgroundStyle

Returns the background style of the window.

var BestSize

GetBestSize() -> Size

This functions returns the best acceptable minimal size for the window.

var BestVirtualSize

GetBestVirtualSize() -> Size

Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means)

var Border

GetBorder(flags) -> Border GetBorder() -> Border

Get the window border style from the given flags: this is different from simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to translate wxBORDER_DEFAULT to something reasonable.

var BufferedDraw

GetBufferedDraw() -> bool

Is drawing done first into a buffer or direct to the screen?

var Caret

GetCaret() -> Caret

Returns the caret() associated with the window.

var CaretForeground

GetCaretForeground() -> Colour

Get the foreground colour of the caret.

var CaretLineBackAlpha

GetCaretLineBackAlpha() -> int

Get the background alpha of the caret line.

var CaretLineBackground

GetCaretLineBackground() -> Colour

Get the colour of the background of the line containing the caret.

var CaretLineVisible

GetCaretLineVisible() -> bool

Is the background of the line containing the caret in a different colour?

var CaretPeriod

GetCaretPeriod() -> int

Get the time in milliseconds that the caret is on and off.

var CaretSticky

GetCaretSticky() -> int

Can the caret preferred x position only be changed by explicit movement commands?

var CaretStyle

GetCaretStyle() -> int

Returns the current style of the caret.

var CaretWidth

GetCaretWidth() -> int

Returns the width of the insert mode caret.

var CharHeight

GetCharHeight() -> int

Returns the character height for this window.

var CharWidth

GetCharWidth() -> int

Returns the average character width for this window.

var CharacterPointer

GetCharacterPointer() -> PyObject

Compact the document buffer and return a read-only memoryview object of the characters in the document.

var Children

GetChildren() -> WindowList

Returns a reference to the list of the window's children.

var ClassInfo

GetClassInfo() -> ClassInfo

This virtual function is redefined for every class that requires run- time type information, when using the wxDECLARE_CLASS macro (or similar).

var ClassName

GetClassName() -> Char

Returns the class name of the C++ class using wxRTTI.

var ClientAreaOrigin

GetClientAreaOrigin() -> Point

Get the origin of the client area of the window relative to the window top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...)

var ClientRect

GetClientRect() -> Rect

Get the client rectangle in window (i.e. client) coordinates.

var ClientSize

GetClientSize() -> Size

Returns the size of the window 'client area' in pixels.

var CodePage

GetCodePage() -> int

Get the code page used to interpret the bytes of the document as characters.

var Constraints

GetConstraints() -> LayoutConstraints

Returns a pointer to the window's layout constraints, or NULL if there are none.

var ContainingSizer

GetContainingSizer() -> Sizer

Returns the sizer of which this window is a member, if any, otherwise NULL.

var ControlCharSymbol

GetControlCharSymbol() -> int

Get the way control characters are displayed.

var CurLine

GetCurLine() -> (String, linePos)

Retrieve the text of the line containing the caret.

var CurLineRaw

GetCurLineRaw() -> (CharBuffer, linePos)

Retrieve the text of the line containing the caret.

var CurrentLine

GetCurrentLine() -> int

Returns the line number of the line with the caret.

var CurrentPos

GetCurrentPos() -> int

Returns the position of the caret.

var Cursor

GetCursor() -> Cursor

Return the cursor associated with this window.

var DefaultAttributes

GetDefaultAttributes() -> VisualAttributes

Currently this is the same as calling wxWindow::GetClassDefaultAttributes(wxWindow::GetWindowVariant()).

var DefaultStyle

GetDefaultStyle() -> TextAttr

Returns the style currently used for the new text.

var DocPointer

GetDocPointer() -> void

Retrieve a pointer to the document object.

var DropTarget

GetDropTarget() -> DropTarget

Returns the associated drop target, which may be NULL.

var EOLMode

GetEOLMode() -> int

Retrieve the current end of line mode - one of CRLF, CR, or LF.

var EdgeColour

GetEdgeColour() -> Colour

Retrieve the colour used in edge indication.

var EdgeColumn

GetEdgeColumn() -> int

Retrieve the column number which text should be kept within.

var EdgeMode

GetEdgeMode() -> int

Retrieve the edge highlight mode.

var EffectiveMinSize

GetEffectiveMinSize() -> Size

Merges the window's best size into the min size and returns the result.

var Enabled

IsEnabled() -> bool

Returns true if the window is enabled, i.e. if it accepts user input, false otherwise.

var EndAtLastLine

GetEndAtLastLine() -> bool

Retrieve whether the maximum scroll position has the last line at the bottom of the view.

var EndStyled

GetEndStyled() -> int

Retrieve the position of the last correctly styled character.

var EventHandler

GetEventHandler() -> EvtHandler

Returns the event handler for this window.

var EvtHandlerEnabled

GetEvtHandlerEnabled() -> bool

Returns true if the event handler is enabled, false otherwise.

var ExtraAscent

GetExtraAscent() -> int

Get extra ascent for each line.

var ExtraDescent

GetExtraDescent() -> int

Get extra descent for each line.

var ExtraStyle

GetExtraStyle() -> long

Returns the extra style bits for the window.

var FirstVisibleLine

GetFirstVisibleLine() -> int

Retrieve the display line at the top of the display.

var Font

GetFont() -> Font

Returns the font for this window.

var ForegroundColour

GetForegroundColour() -> Colour

Returns the foreground colour of the window.

var GapPosition

GetGapPosition() -> int

Return a position which, to avoid performance costs, should not be within the range of a call to GetRangePointer.

var GrandParent

GetGrandParent() -> Window

Returns the grandparent of a window, or NULL if there isn't one.

var Handle

GetHandle() -> UIntPtr

Returns the platform-specific handle of the physical window.

var HelpText

GetHelpText() -> String

Gets the help text to be used as context-sensitive help for this window.

var HighlightGuide

GetHighlightGuide() -> int

Get the highlighted indentation guide column.

var Hint

GetHint() -> String

Returns the current hint string.

var HotspotActiveBackground

GetHotspotActiveBackground() -> Colour

Get the back colour for active hotspots.

var HotspotActiveForeground

GetHotspotActiveForeground() -> Colour

Get the fore colour for active hotspots.

var HotspotActiveUnderline

GetHotspotActiveUnderline() -> bool

Get whether underlining for active hotspots.

var HotspotSingleLine

GetHotspotSingleLine() -> bool

Get the HotspotSingleLine property.

var Id

GetId() -> WindowID

Returns the identifier of the window.

var Identifier

GetIdentifier() -> int

Get the identifier.

var Indent

GetIndent() -> int

Retrieve indentation size.

var IndentationGuides

GetIndentationGuides() -> int

Are the indentation guides visible?

var IndicatorCurrent

GetIndicatorCurrent() -> int

Get the current indicator.

var IndicatorValue

GetIndicatorValue() -> int

Get the current indicator value.

var InsertionPoint

GetInsertionPoint() -> long

Returns the insertion point, or cursor, position.

var KeysUnicode

GetKeysUnicode() -> bool

Are keys always interpreted as Unicode?

var Label

GetLabel() -> String

Returns the control's label, as it was passed to SetLabel().

var LabelText

GetLabelText() -> String GetLabelText(label) -> String

Returns the control's label without mnemonics.

var LastKeydownProcessed

GetLastKeydownProcessed() -> bool

Can be used to prevent the EVT_CHAR handler from adding the char.

var LastPosition

GetLastPosition() -> long

Returns the zero based index of the last position in the text control, which is equal to the number of characters in the control.

var LayoutCache

GetLayoutCache() -> int

Retrieve the degree of caching of layout information.

var LayoutDirection

GetLayoutDirection() -> LayoutDirection

Returns the layout direction for this window, Note that wxLayout_Default is returned if layout direction is not supported.

var Length

GetLength() -> int

Returns the number of bytes in the document.

var Lexer

GetLexer() -> int

Retrieve the lexing language of the document.

var LineCount

GetLineCount() -> int

Returns the number of lines in the document.

var MainSelection

GetMainSelection() -> int

Which selection is the main selection.

var MarginLeft

GetMarginLeft() -> int

Returns the size in pixels of the left margin.

var MarginOptions

GetMarginOptions() -> int

Get the margin options.

var MarginRight

GetMarginRight() -> int

Returns the size in pixels of the right margin.

var Margins

GetMargins() -> Point

Returns the margins used by the control.

var MaxClientSize

GetMaxClientSize() -> Size

Returns the maximum size of window's client area.

var MaxHeight

GetMaxHeight() -> int

Returns the vertical component of window maximal size.

var MaxLineState

GetMaxLineState() -> int

Retrieve the last line number that has line state.

var MaxSize

GetMaxSize() -> Size

Returns the maximum size of the window.

var MaxWidth

GetMaxWidth() -> int

Returns the horizontal component of window maximal size.

var MinClientSize

GetMinClientSize() -> Size

Returns the minimum size of window's client area, an indication to the sizer layout mechanism that this is the minimum required size of its client area.

var MinHeight

GetMinHeight() -> int

Returns the vertical component of window minimal size.

var MinSize

GetMinSize() -> Size

Returns the minimum size of the window, an indication to the sizer layout mechanism that this is the minimum required size.

var MinWidth

GetMinWidth() -> int

Returns the horizontal component of window minimal size.

var ModEventMask

GetModEventMask() -> int

Get which document modification events are sent to the container.

var Modify

GetModify() -> bool

Is the document different from when it was last saved?

var MouseDownCaptures

GetMouseDownCaptures() -> bool

Get whether mouse gets captured.

var MouseDwellTime

GetMouseDwellTime() -> int

Retrieve the time the mouse must sit still to generate a mouse dwell event.

var MultiPaste

GetMultiPaste() -> int

Retrieve the effect of pasting when there are multiple selections.

var MultipleSelection

GetMultipleSelection() -> bool

Whether multiple selections can be made.

var Name

GetName() -> String

Returns the window's name.

var NextHandler

GetNextHandler() -> EvtHandler

Returns the pointer to the next handler in the chain.

var NumberOfLines

GetNumberOfLines() -> int

var Overtype

GetOvertype() -> bool

Returns true if overtype mode is active otherwise false is returned.

var Parent

GetParent() -> Window

Returns the parent of the window, or NULL if there is no parent.

var PasteConvertEndings

GetPasteConvertEndings() -> bool

Get convert-on-paste setting.

var Position

GetPosition() -> Point

This gets the position of the window in pixels, relative to the parent window for the child windows or relative to the display origin for the top level windows.

var PositionCacheSize

GetPositionCacheSize() -> int

How many entries are allocated to the position cache?

var PreviousHandler

GetPreviousHandler() -> EvtHandler

Returns the pointer to the previous handler in the chain.

var PrintColourMode

GetPrintColourMode() -> int

Returns the print colour mode.

var PrintMagnification

GetPrintMagnification() -> int

Returns the print magnification.

var PrintWrapMode

GetPrintWrapMode() -> int

Is printing line wrapped?

var PunctuationChars

GetPunctuationChars() -> String

Get the set of characters making up punctuation characters.

var RangePointer

GetRangePointer(position, rangeLength) -> PyObject

Return a read-only pointer to a range of characters in the document. May move the gap so that the range is contiguous, but will only move up to rangeLength bytes.

var ReadOnly

GetReadOnly() -> bool

In read-only mode?

var Rect

GetRect() -> Rect

Returns the position and size of the window as a wxRect object.

var RectangularSelectionAnchor

GetRectangularSelectionAnchor() -> int

var RectangularSelectionAnchorVirtualSpace

GetRectangularSelectionAnchorVirtualSpace() -> int

var RectangularSelectionCaret

GetRectangularSelectionCaret() -> int

var RectangularSelectionCaretVirtualSpace

GetRectangularSelectionCaretVirtualSpace() -> int

var RectangularSelectionModifier

GetRectangularSelectionModifier() -> int

Get the modifier key used for rectangular selection.

var RefData

GetRefData() -> ObjectRefData

Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.

var STCCursor

GetSTCCursor() -> int

Get cursor type.

var STCFocus

GetSTCFocus() -> bool

Get internal focus flag.

var ScreenPosition

GetScreenPosition() -> Point

Returns the window position in screen coordinates, whether the window is a child window or a top level one.

var ScreenRect

GetScreenRect() -> Rect

Returns the position and size of the window on the screen as a wxRect object.

var ScrollWidth

GetScrollWidth() -> int

Retrieve the document width assumed for scrolling.

var ScrollWidthTracking

GetScrollWidthTracking() -> bool

Retrieve whether the scroll width tracks wide lines.

var SearchFlags

GetSearchFlags() -> int

Get the search flags used by SearchInTarget.

var SelAlpha

GetSelAlpha() -> int

Get the alpha of the selection.

var SelEOLFilled

GetSelEOLFilled() -> bool

Is the selection end of line filled?

var SelectedText

GetSelectedText() -> String

Retrieve the selected text.

var SelectedTextRaw

GetSelectedTextRaw() -> CharBuffer

Retrieve the selected text.

var SelectionEnd

GetSelectionEnd() -> int

Returns the position at the end of the selection.

var SelectionMode

GetSelectionMode() -> int

Get the mode of the current selection.

var SelectionStart

GetSelectionStart() -> int

Returns the position at the start of the selection.

var Selections

GetSelections() -> int

How many selections are there?

var Shown

IsShown() -> bool

Returns true if the window is shown, false if it has been hidden.

var Size

GetSize() -> Size

Returns the size of the entire window in pixels, including title bar, border, scrollbars, etc.

var Sizer

GetSizer() -> Sizer

Returns the sizer associated with the window by a previous call to SetSizer(), or NULL.

var Status

GetStatus() -> int

Get error status.

var StringSelection

GetStringSelection() -> String

Gets the text currently selected in the control.

var StyleBits

GetStyleBits() -> int

Retrieve number of bits in style bytes used to hold the lexical state.

var StyleBitsNeeded

GetStyleBitsNeeded() -> int

Retrieve the number of bits the current lexer needs for styling.

var TabIndents

GetTabIndents() -> bool

Does a tab pressed when caret is within indentation indent?

var TabWidth

GetTabWidth() -> int

Retrieve the visible size of a tab.

var TargetEnd

GetTargetEnd() -> int

Get the position that ends the target.

var TargetStart

GetTargetStart() -> int

Get the position that starts the target.

var Technology

GetTechnology() -> int

Get the tech.

var Text

GetText() -> String

Retrieve all the text in the document.

var TextLength

GetTextLength() -> int

Retrieve the number of characters in the document.

var TextRaw

GetTextRaw() -> CharBuffer

Retrieve all the text in the document.

var ThemeEnabled

GetThemeEnabled() -> bool

Clears the window by filling it with the current background colour.

var ToolTip

GetToolTip() -> ToolTip

Get the associated tooltip or NULL if none.

var TopLevel

IsTopLevel() -> bool

Returns true if the given window is a top-level one.

var TopLevelParent

GetTopLevelParent() -> Window

Returns the first ancestor of this window which is a top-level window.

var TwoPhaseDraw

GetTwoPhaseDraw() -> bool

Is drawing done in two phases with backgrounds drawn before foregrounds?

var UndoCollection

GetUndoCollection() -> bool

Is undo history being collected?

var UpdateClientRect

GetUpdateClientRect() -> Rect

Get the update rectangle bounding box in client coords.

var UpdateRegion

GetUpdateRegion() -> Region

Returns the region specifying which parts of the window have been damaged.

var UseHorizontalScrollBar

GetUseHorizontalScrollBar() -> bool

Is the horizontal scroll bar visible?

var UseTabs

GetUseTabs() -> bool

Retrieve whether tabs will be used in indentation.

var UseVerticalScrollBar

GetUseVerticalScrollBar() -> bool

Is the vertical scroll bar visible?

var Validator

GetValidator() -> Validator

Validator functions.

var Value

GetValue() -> String

Gets the contents of the control.

var ViewEOL

GetViewEOL() -> bool

Are the end of line characters visible?

var ViewWhiteSpace

GetViewWhiteSpace() -> int

Are white space characters currently visible? Returns one of SCWS_* constants.

var VirtualSize

GetVirtualSize() -> Size

This gets the virtual size of the window in pixels.

var VirtualSpaceOptions

GetVirtualSpaceOptions() -> int

var WhitespaceChars

GetWhitespaceChars() -> String

Get the set of characters making up whitespace for when moving or selecting by word.

var WhitespaceSize

GetWhitespaceSize() -> int

Get the size of the dots used to mark space characters.

var WindowStyle

GetWindowStyle() -> long

See GetWindowStyleFlag() for more info.

var WindowStyleFlag

GetWindowStyleFlag() -> long

Gets the window style that was passed to the constructor or Create() method.

var WindowVariant

GetWindowVariant() -> WindowVariant

Returns the value previously passed to SetWindowVariant().

var WordChars

GetWordChars() -> String

Get the set of characters making up words for when moving or selecting by word.

var WrapIndentMode

GetWrapIndentMode() -> int

Retrieve how wrapped sublines are placed.

var WrapMode

GetWrapMode() -> int

Retrieve whether text is word wrapped.

var WrapStartIndent

GetWrapStartIndent() -> int

Retrive the start indent for wrapped lines.

var WrapVisualFlags

GetWrapVisualFlags() -> int

Retrive the display mode of visual flags for wrapped lines.

var WrapVisualFlagsLocation

GetWrapVisualFlagsLocation() -> int

Retrive the location of visual flags for wrapped lines.

var XOffset

GetXOffset() -> int

var Zoom

GetZoom() -> int

Retrieve the zoom level.

class StyledTextCtrlPanel

Panel() Panel(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=TAB_TRAVERSAL, name=PanelNameStr)

A panel is a window on which controls are placed.

Show source ≡

    class StyledTextCtrlPanel(wx.Panel):
        _custom_classes = {'wx.stc.StyledTextCtrl': ['PythonSTC','XMLSTC']}
        def _init_coll_boxSizer1_Items(self, parent):
            # generated method, don't edit

            parent.Add(self.styledTextCtrl1, 1, border=2, flag=wx.EXPAND)

        def _init_sizers(self):
            # generated method, don't edit
            self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)

            self._init_coll_boxSizer1_Items(self.boxSizer1)

            self.SetSizer(self.boxSizer1)

        def _init_ctrls(self, prnt):
            # generated method, don't edit
            wx.Panel.__init__(self, id=wxID_STYLEDTEXTCTRLPANEL,
                  name='StyledTextCtrlPanel', parent=prnt, pos=wx.Point(519, 269),
                  size=wx.Size(589, 342), style=wx.TAB_TRAVERSAL)
            self.SetClientSize(wx.Size(573, 304))

            self.styledTextCtrl1 = XMLSTC(id=wxID_STYLEDTEXTCTRLPANELSTYLEDTEXTCTRL1,
                  name='styledTextCtrl1', parent=self, pos=wx.Point(0, 0),
                  size=wx.Size(573, 304), style=0)

            self._init_sizers()

        def __init__(self, parent, id, pos, size, style, name):
            self._init_ctrls(parent)

### Ancestors (in MRO)

- StyledTextCtrlPanel
- wx._core.Panel
- wx._core.Window
- wx._core.WindowBase
- wx._core.EvtHandler
- wx._core.Object
- wx._core.Trackable
- sip.wrapper
- sip.simplewrapper
- builtins.object

### Class variables

var ChildrenRepositioningGuard

### Static methods

def __init__(

self, parent, id, pos, size, style, name)

Initialize self. See help(type(self)) for accurate signature.

Show source ≡

    def __init__(self, parent, id, pos, size, style, name):
        self._init_ctrls(parent)

def Bind(

self, event, handler, source=None, id=-1, id2=-1)

Bind an event to an event handler.

:param event: One of the `EVT_*` event binder objects that specifies the type of event to bind.

:param handler: A callable object to be invoked when the event is delivered to self. Pass `None` to disconnect an event handler.

:param source: Sometimes the event originates from a different window than self, but you still want to catch it in self. (For example, a button event delivered to a frame.) By passing the source of the event, the event handling system is able to differentiate between the same event type from different controls.

:param id: Used to spcify the event source by ID instead of instance.

:param id2: Used when it is desirable to bind a handler to a range of IDs, such as with EVT_MENU_RANGE.

Show source ≡

    def _EvtHandler_Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
        """
        Bind an event to an event handler.

        :param event: One of the ``EVT_*`` event binder objects that
                      specifies the type of event to bind.

        :param handler: A callable object to be invoked when the
                        event is delivered to self.  Pass ``None`` to
                        disconnect an event handler.

        :param source: Sometimes the event originates from a
                       different window than self, but you still
                       want to catch it in self.  (For example, a
                       button event delivered to a frame.)  By
                       passing the source of the event, the event
                       handling system is able to differentiate
                       between the same event type from different
                       controls.

        :param id: Used to spcify the event source by ID instead
                   of instance.

        :param id2: Used when it is desirable to bind a handler
                    to a range of IDs, such as with EVT_MENU_RANGE.
        """
        assert isinstance(event, wx.PyEventBinder)
        assert callable(handler) or handler is None
        assert source is None or hasattr(source, 'GetId')
        if source is not None:
            id  = source.GetId()
        event.Bind(self, id, id2, handler)

def ConvertDialogPointToPixels(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def ConvertDialogSizeToPixels(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def DLG_UNIT(

self, dlg_unit)

A convenience wrapper for :meth:`ConvertDialogToPixels`.

Show source ≡

    def _Window_DLG_UNIT(self, dlg_unit):
        """
        A convenience wrapper for :meth:`ConvertDialogToPixels`.
        """
        is_wxType = isinstance(dlg_unit, (wx.Size, wx.Point))
        pix = self.ConvertDialogToPixels(dlg_unit)
        if not is_wxType:
            pix = tuple(pix)
        return pix

def DestroyLater(

self)

Schedules the window to be destroyed in the near future.

This should be used whenever Destroy could happen too soon, such as when there may still be events for this window or its children waiting in the event queue.

Show source ≡

    def _Window_DestroyLater(self):
        """
        Schedules the window to be destroyed in the near future.

        This should be used whenever Destroy could happen too soon, such
        as when there may still be events for this window or its children
        waiting in the event queue.
        """
        self.Hide()
        wx.GetApp().ScheduleForDestruction(self)

def GetPositionTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def GetSizeTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def GetVirtualSizeTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def MoveXY(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def PostCreate(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetClientRect(

self, rect)

Show source ≡

    def _Window_SetClientRect(self, rect):
        return self.SetClientSize(rect)

def SetDimensions(

*args, **kw)

SetDimensions(x, y, width, height, sizeFlags=SIZE_AUTO)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetRect(

self, rect)

Show source ≡

    def _Window_SetRect(self, rect):
        return self.SetSize(rect)

def SetSizeHintsSz(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetSizeWH(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetToolTipString(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetVirtualSizeWH(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def Unbind(

self, event, source=None, id=-1, id2=-1, handler=None)

Disconnects the event handler binding for event from `self`. Returns `True` if successful.

Show source ≡

    def _EvtHandler_Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None):
        """
        Disconnects the event handler binding for event from `self`.
        Returns ``True`` if successful.
        """
        if source is not None:
            id  = source.GetId()
        return event.Unbind(self, id, id2, handler)

### Instance variables

var AcceleratorTable

GetAcceleratorTable() -> AcceleratorTable

Gets the accelerator table for this window.

var AutoLayout

GetAutoLayout() -> bool

Returns the sizer of which this window is a member, if any, otherwise NULL.

var BackgroundColour

GetBackgroundColour() -> Colour

Returns the background colour of the window.

var BackgroundStyle

GetBackgroundStyle() -> BackgroundStyle

Returns the background style of the window.

var BestSize

GetBestSize() -> Size

This functions returns the best acceptable minimal size for the window.

var BestVirtualSize

GetBestVirtualSize() -> Size

Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means)

var Border

GetBorder(flags) -> Border GetBorder() -> Border

Get the window border style from the given flags: this is different from simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to translate wxBORDER_DEFAULT to something reasonable.

var Caret

GetCaret() -> Caret

Returns the caret() associated with the window.

var CharHeight

GetCharHeight() -> int

Returns the character height for this window.

var CharWidth

GetCharWidth() -> int

Returns the average character width for this window.

var Children

GetChildren() -> WindowList

Returns a reference to the list of the window's children.

var ClassInfo

GetClassInfo() -> ClassInfo

This virtual function is redefined for every class that requires run- time type information, when using the wxDECLARE_CLASS macro (or similar).

var ClassName

GetClassName() -> Char

Returns the class name of the C++ class using wxRTTI.

var ClientAreaOrigin

GetClientAreaOrigin() -> Point

Get the origin of the client area of the window relative to the window top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...)

var ClientRect

GetClientRect() -> Rect

Get the client rectangle in window (i.e. client) coordinates.

var ClientSize

GetClientSize() -> Size

Returns the size of the window 'client area' in pixels.

var Constraints

GetConstraints() -> LayoutConstraints

Returns a pointer to the window's layout constraints, or NULL if there are none.

var ContainingSizer

GetContainingSizer() -> Sizer

Returns the sizer of which this window is a member, if any, otherwise NULL.

var Cursor

GetCursor() -> Cursor

Return the cursor associated with this window.

var DefaultAttributes

GetDefaultAttributes() -> VisualAttributes

Currently this is the same as calling wxWindow::GetClassDefaultAttributes(wxWindow::GetWindowVariant()).

var DropTarget

GetDropTarget() -> DropTarget

Returns the associated drop target, which may be NULL.

var EffectiveMinSize

GetEffectiveMinSize() -> Size

Merges the window's best size into the min size and returns the result.

var Enabled

IsEnabled() -> bool

Returns true if the window is enabled, i.e. if it accepts user input, false otherwise.

var EventHandler

GetEventHandler() -> EvtHandler

Returns the event handler for this window.

var EvtHandlerEnabled

GetEvtHandlerEnabled() -> bool

Returns true if the event handler is enabled, false otherwise.

var ExtraStyle

GetExtraStyle() -> long

Returns the extra style bits for the window.

var Font

GetFont() -> Font

Returns the font for this window.

var ForegroundColour

GetForegroundColour() -> Colour

Returns the foreground colour of the window.

var GrandParent

GetGrandParent() -> Window

Returns the grandparent of a window, or NULL if there isn't one.

var Handle

GetHandle() -> UIntPtr

Returns the platform-specific handle of the physical window.

var HelpText

GetHelpText() -> String

Gets the help text to be used as context-sensitive help for this window.

var Id

GetId() -> WindowID

Returns the identifier of the window.

var Label

GetLabel() -> String

Generic way of getting a label from any window, for identification purposes.

var LayoutDirection

GetLayoutDirection() -> LayoutDirection

Returns the layout direction for this window, Note that wxLayout_Default is returned if layout direction is not supported.

var MaxClientSize

GetMaxClientSize() -> Size

Returns the maximum size of window's client area.

var MaxHeight

GetMaxHeight() -> int

Returns the vertical component of window maximal size.

var MaxSize

GetMaxSize() -> Size

Returns the maximum size of the window.

var MaxWidth

GetMaxWidth() -> int

Returns the horizontal component of window maximal size.

var MinClientSize

GetMinClientSize() -> Size

Returns the minimum size of window's client area, an indication to the sizer layout mechanism that this is the minimum required size of its client area.

var MinHeight

GetMinHeight() -> int

Returns the vertical component of window minimal size.

var MinSize

GetMinSize() -> Size

Returns the minimum size of the window, an indication to the sizer layout mechanism that this is the minimum required size.

var MinWidth

GetMinWidth() -> int

Returns the horizontal component of window minimal size.

var Name

GetName() -> String

Returns the window's name.

var NextHandler

GetNextHandler() -> EvtHandler

Returns the pointer to the next handler in the chain.

var Parent

GetParent() -> Window

Returns the parent of the window, or NULL if there is no parent.

var Position

GetPosition() -> Point

This gets the position of the window in pixels, relative to the parent window for the child windows or relative to the display origin for the top level windows.

var PreviousHandler

GetPreviousHandler() -> EvtHandler

Returns the pointer to the previous handler in the chain.

var Rect

GetRect() -> Rect

Returns the position and size of the window as a wxRect object.

var RefData

GetRefData() -> ObjectRefData

Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.

var ScreenPosition

GetScreenPosition() -> Point

Returns the window position in screen coordinates, whether the window is a child window or a top level one.

var ScreenRect

GetScreenRect() -> Rect

Returns the position and size of the window on the screen as a wxRect object.

var Shown

IsShown() -> bool

Returns true if the window is shown, false if it has been hidden.

var Size

GetSize() -> Size

Returns the size of the entire window in pixels, including title bar, border, scrollbars, etc.

var Sizer

GetSizer() -> Sizer

Returns the sizer associated with the window by a previous call to SetSizer(), or NULL.

var ThemeEnabled

GetThemeEnabled() -> bool

Clears the window by filling it with the current background colour.

var ToolTip

GetToolTip() -> ToolTip

Get the associated tooltip or NULL if none.

var TopLevel

IsTopLevel() -> bool

Returns true if the given window is a top-level one.

var TopLevelParent

GetTopLevelParent() -> Window

Returns the first ancestor of this window which is a top-level window.

var UpdateClientRect

GetUpdateClientRect() -> Rect

Get the update rectangle bounding box in client coords.

var UpdateRegion

GetUpdateRegion() -> Region

Returns the region specifying which parts of the window have been damaged.

var Validator

GetValidator() -> Validator

Validator functions.

var VirtualSize

GetVirtualSize() -> Size

This gets the virtual size of the window in pixels.

var WindowStyle

GetWindowStyle() -> long

See GetWindowStyleFlag() for more info.

var WindowStyleFlag

GetWindowStyleFlag() -> long

Gets the window style that was passed to the constructor or Create() method.

var WindowVariant

GetWindowVariant() -> WindowVariant

Returns the value previously passed to SetWindowVariant().

class XMLSTC

This is a modified StyledTextCtrl for xml. It has weirdness because it was adpated from a Python STC in wx examples.

Show source ≡

    class XMLSTC(stc.StyledTextCtrl):
        """ This is a modified StyledTextCtrl for xml. It has weirdness because it was adpated from
        a Python STC in wx examples."""
        fold_symbols = 2

        def __init__(self, parent, id,
                     pos=wx.DefaultPosition, size=wx.DefaultSize,
                     style=0,name=None):
            stc.StyledTextCtrl.__init__(self, parent, id, pos, size, style,name)

            self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
            self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)

            self.SetLexer(stc.STC_LEX_XML)
            #self.SetKeyWords(0, " ".join(keyword.kwlist))

            self.SetProperty("fold", "1")
            self.SetProperty("tab.timmy.whinge.level", "1")
            self.SetMargins(0,0)

            #self.SetViewWhiteSpace(False)
            #self.SetBufferedDraw(False)
            #self.SetViewEOL(True)
            #self.SetEOLMode(stc.STC_EOL_CRLF)
            #self.SetUseAntiAliasing(True)

            self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
            self.SetEdgeColumn(78)

            # Setup a margin to hold fold markers
            self.SetFoldFlags(16)  ###  WHAT IS THIS VALUE?  WHAT ARE THE OTHER FLAGS?  DOES IT MATTER?
            self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
            self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
            self.SetMarginSensitive(2, True)
            self.SetMarginWidth(2, 12)

            if self.fold_symbols == 0:
                # Arrow pointing right for contracted folders, arrow pointing down for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_ARROWDOWN, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_ARROW, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "black", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,     "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,     "white", "black")

            elif self.fold_symbols == 1:
                # Plus for contracted folders, minus for expanded
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_MINUS, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_PLUS,  "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")

            elif self.fold_symbols == 2:
                # Like a flattened tree control using circular headers and curved joins
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_CIRCLEMINUS,          "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_CIRCLEPLUS,           "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,                "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNERCURVE,         "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_CIRCLEPLUSCONNECTED,  "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE,         "white", "#404040")

            elif self.fold_symbols == 3:
                # Like a flattened tree control using square headers
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_BOXMINUS,          "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_BOXPLUS,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,             "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNER,           "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_BOXPLUSCONNECTED,  "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
                self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,           "white", "#808080")

            self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
            self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
            self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)

            # Make some styles,  The lexer defines what each style is used for, we
            # just have to define what each style looks like.  This set is adapted from
            # Scintilla sample property files.

            # Global default styles for all languages
            self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
            self.StyleClearAll()  # Reset all to be like the default

            # Global default styles for all languages
            self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
            self.StyleSetSpec(stc.STC_STYLE_LINENUMBER,  "back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces)
            self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(other)s" % faces)
            #self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
            #self.StyleSetSpec(stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")
    #styleidnames={wx.stc.STC_H_DEFAULT: 'Default', wx.stc.STC_H_TAG: 'Tag', wx.stc.STC_H_TAGUNKNOWN: 'Tag unknown', wx.stc.STC_H_ATTRIBUTE: 'Attribute', wx.stc.STC_H_NUMBER: 'Number', wx.stc.STC_H_DOUBLESTRING: 'Double quoted string', wx.stc.STC_H_SINGLESTRING:'Single quoted string', wx.stc.STC_H_OTHER: 'Other inside tag', wx.stc.STC_H_COMMENT: 'Comment', wx.stc.STC_H_ENTITY: 'Entity', wx.stc.STC_H_TAGEND: 'Tag end', wx.stc.STC_H_XMLSTART: 'XML start', wx.stc.STC_H_XMLEND: 'XML End'}

    ##TOD:This is the section I have to define the styles for in order to work
    # styles=['STC_H_ASP', 'STC_H_ASPAT', 'STC_H_ATTRIBUTE', 'STC_H_ATTRIBUTEUNKNOWN',
    # 'STC_H_CDATA', 'STC_H_COMMENT', 'STC_H_DEFAULT', 'STC_H_DOUBLESTRING', 'STC_H_ENTITY',
    # 'STC_H_NUMBER', 'STC_H_OTHER', 'STC_H_QUESTION', 'STC_H_SCRIPT', 'STC_H_SGML_1ST_PARAM',
    # 'STC_H_SGML_1ST_PARAM_COMMENT', 'STC_H_SGML_BLOCK_DEFAULT', 'STC_H_SGML_COMMAND',
    #'STC_H_SGML_COMMENT', 'STC_H_SGML_DEFAULT', 'STC_H_SGML_DOUBLESTRING', 'STC_H_SGML_ENTITY',
    #'STC_H_SGML_ERROR', 'STC_H_SGML_SIMPLESTRING', 'STC_H_SGML_SPECIAL',
    #'STC_H_SINGLESTRING', 'STC_H_TAG', 'STC_H_TAGEND', 'STC_H_TAGUNKNOWN',
    #'STC_H_VALUE', 'STC_H_XCCOMMENT', 'STC_H_XMLEND', 'STC_H_XMLSTART']
            # XML styles, just taken from the above python sample

            # XML styles Mostly HTML styles
            # Default
            self.StyleSetSpec(stc.STC_H_DEFAULT, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comments
            self.StyleSetSpec(stc.STC_H_XCCOMMENT, "fore:#007F00,face:%(other)s,size:%(size)d" % faces)
            # Number
            self.StyleSetSpec(stc.STC_H_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
            # String
            self.StyleSetSpec(stc.STC_H_ATTRIBUTE, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Single quoted string
            self.StyleSetSpec(stc.STC_H_QUESTION, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
            # Keyword
            self.StyleSetSpec(stc.STC_H_ATTRIBUTEUNKNOWN, "fore:#00007F,bold,size:%(size)d" % faces)
            # Single quotes
            self.StyleSetSpec(stc.STC_H_SINGLESTRING, "fore:#7F0000,size:%(size)d" % faces)
            # double quotes
            self.StyleSetSpec(stc.STC_H_DOUBLESTRING, "fore:#7F0000,size:%(size)d" % faces)
            # Tag name definition
            self.StyleSetSpec(stc.STC_H_TAG, "fore:#0000FF,bold,size:%(size)d" % faces)
            # UnknownTag definition
            self.StyleSetSpec(stc.STC_H_TAGUNKNOWN, "fore:#007F7F,bold,size:%(size)d" % faces)
            # Operators
            self.StyleSetSpec(stc.STC_H_XMLSTART, "bold,size:%(size)d" % faces)
            # Identifiers
            self.StyleSetSpec(stc.STC_H_CDATA, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
            # Comment-blocks
            self.StyleSetSpec(stc.STC_H_COMMENT, "fore:#7F007F,underline,size:%(size)d" % faces)
            # End of line where string is not closed
            #self.StyleSetSpec(stc.STC_H_XMLEND, "fore:#000000,face:%(mono)s,size:%(size)d" % faces)

            self.SetCaretForeground("BLUE")

            self.SetCaretForeground("BLUE")

            # register some images for use in the AutoComplete box.
            self.RegisterImage(1, wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(2,
                wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
            self.RegisterImage(3,
                wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16)))

        def OnKeyPressed(self, event):
            if self.CallTipActive():
                self.CallTipCancel()
            key = event.GetKeyCode()

            if key == 32 and event.ControlDown():
                pos = self.GetCurrentPos()

                # Tips
                if event.ShiftDown():
                    self.CallTipSetBackground("yellow")
                    self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n'
                                     'show some suff, maybe parameters..\n\n'
                                     'fubar(param1, param2)')
                # Code completion
                else:
                    #lst = []
                    #for x in range(50000):
                    #    lst.append('%05d' % x)
                    #st = " ".join(lst)
                    #print len(st)
                    #self.AutoCompShow(0, st)

                    kw = keyword.kwlist[:]
                    kw.append("zzzzzz?2")
                    kw.append("aaaaa?2")
                    kw.append("__init__?3")
                    kw.append("zzaaaaa?2")
                    kw.append("zzbaaaa?2")
                    kw.append("this_is_a_longer_value")
                    #kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")

                    kw.sort()  # Python sorts are case sensitive
                    self.AutoCompSetIgnoreCase(False)  # so this needs to match

                    # Images are specified with a appended "?type"
                    for i in range(len(kw)):
                        if kw[i] in keyword.kwlist:
                            kw[i] = kw[i] + "?1"

                    self.AutoCompShow(0, " ".join(kw))
            else:
                event.Skip()

        def OnUpdateUI(self, evt):
            # check for matching braces
            braceAtCaret = -1
            braceOpposite = -1
            charBefore = None
            caretPos = self.GetCurrentPos()

            if caretPos > 0:
                charBefore = self.GetCharAt(caretPos - 1)
                styleBefore = self.GetStyleAt(caretPos - 1)

            # check before
            if charBefore and chr(charBefore) in "[]{}()<>" and styleBefore == stc.STC_H_XMLSTART:
                braceAtCaret = caretPos - 1

            # check after
            if braceAtCaret < 0:
                charAfter = self.GetCharAt(caretPos)
                styleAfter = self.GetStyleAt(caretPos)

                if charAfter and chr(charAfter) in "[]{}()<>" and styleAfter == stc.STC_H_XMLEND:
                    braceAtCaret = caretPos

            if braceAtCaret >= 0:
                braceOpposite = self.BraceMatch(braceAtCaret)

            if braceAtCaret != -1  and braceOpposite == -1:
                self.BraceBadLight(braceAtCaret)
            else:
                self.BraceHighlight(braceAtCaret, braceOpposite)
                #pt = self.PointFromPosition(braceOpposite)
                #self.Refresh(True, wxRect(pt.x, pt.y, 5,5))
                #print pt
                #self.Refresh(False)

        def OnMarginClick(self, evt):
            # fold and unfold as needed
            if evt.GetMargin() == 2:
                if evt.GetShift() and evt.GetControl():
                    self.FoldAll()
                else:
                    lineClicked = self.LineFromPosition(evt.GetPosition())

                    if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG:
                        if evt.GetShift():
                            self.SetFoldExpanded(lineClicked, True)
                            self.Expand(lineClicked, True, True, 1)
                        elif evt.GetControl():
                            if self.GetFoldExpanded(lineClicked):
                                self.SetFoldExpanded(lineClicked, False)
                                self.Expand(lineClicked, False, True, 0)
                            else:
                                self.SetFoldExpanded(lineClicked, True)
                                self.Expand(lineClicked, True, True, 100)
                        else:
                            self.ToggleFold(lineClicked)

        def FoldAll(self):
            lineCount = self.GetLineCount()
            expanding = True

            # find out if we are folding or unfolding
            for lineNum in range(lineCount):
                if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
                    expanding = not self.GetFoldExpanded(lineNum)
                    break

            lineNum = 0

            while lineNum < lineCount:
                level = self.GetFoldLevel(lineNum)
                if level & stc.STC_FOLDLEVELHEADERFLAG and \
                   (level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE:

                    if expanding:
                        self.SetFoldExpanded(lineNum, True)
                        lineNum = self.Expand(lineNum, True)
                        lineNum = lineNum - 1
                    else:
                        lastChild = self.GetLastChild(lineNum, -1)
                        self.SetFoldExpanded(lineNum, False)

                        if lastChild > lineNum:
                            self.HideLines(lineNum+1, lastChild)

                lineNum = lineNum + 1

        def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
            lastChild = self.GetLastChild(line, level)
            line = line + 1

            while line <= lastChild:
                if force:
                    if visLevels > 0:
                        self.ShowLines(line, line)
                    else:
                        self.HideLines(line, line)
                else:
                    if doExpand:
                        self.ShowLines(line, line)

                if level == -1:
                    level = self.GetFoldLevel(line)

                if level & stc.STC_FOLDLEVELHEADERFLAG:
                    if force:
                        if visLevels > 1:
                            self.SetFoldExpanded(line, True)
                        else:
                            self.SetFoldExpanded(line, False)

                        line = self.Expand(line, doExpand, force, visLevels-1)

                    else:
                        if doExpand and self.GetFoldExpanded(line):
                            line = self.Expand(line, True, force, visLevels-1)
                        else:
                            line = self.Expand(line, False, force, visLevels-1)
                else:
                    line = line + 1

            return line

### Ancestors (in MRO)

- XMLSTC
- wx._stc.StyledTextCtrl
- wx._core.Control
- wx._core.Window
- wx._core.WindowBase
- wx._core.EvtHandler
- wx._core.Object
- wx._core.Trackable
- sip.wrapper
- sip.simplewrapper
- builtins.object

### Class variables

var ChildrenRepositioningGuard

var fold_symbols

### Static methods

def __init__(

self, parent, id, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=0, name=None)

Initialize self. See help(type(self)) for accurate signature.

Show source ≡

    def __init__(self, parent, id,
                 pos=wx.DefaultPosition, size=wx.DefaultSize,
                 style=0,name=None):
        stc.StyledTextCtrl.__init__(self, parent, id, pos, size, style,name)
        self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN)
        self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT)
        self.SetLexer(stc.STC_LEX_XML)
        #self.SetKeyWords(0, " ".join(keyword.kwlist))
        self.SetProperty("fold", "1")
        self.SetProperty("tab.timmy.whinge.level", "1")
        self.SetMargins(0,0)
        #self.SetViewWhiteSpace(False)
        #self.SetBufferedDraw(False)
        #self.SetViewEOL(True)
        #self.SetEOLMode(stc.STC_EOL_CRLF)
        #self.SetUseAntiAliasing(True)

        self.SetEdgeMode(stc.STC_EDGE_BACKGROUND)
        self.SetEdgeColumn(78)
        # Setup a margin to hold fold markers
        self.SetFoldFlags(16)  ###  WHAT IS THIS VALUE?  WHAT ARE THE OTHER FLAGS?  DOES IT MATTER?
        self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
        self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
        self.SetMarginSensitive(2, True)
        self.SetMarginWidth(2, 12)
        if self.fold_symbols == 0:
            # Arrow pointing right for contracted folders, arrow pointing down for expanded
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_ARROWDOWN, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_ARROW, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "black", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY,     "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY,     "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY,     "white", "black")

        elif self.fold_symbols == 1:
            # Plus for contracted folders, minus for expanded
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_MINUS, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_PLUS,  "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black")
        elif self.fold_symbols == 2:
            # Like a flattened tree control using circular headers and curved joins
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_CIRCLEMINUS,          "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_CIRCLEPLUS,           "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,                "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNERCURVE,         "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_CIRCLEPLUSCONNECTED,  "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE,         "white", "#404040")
        elif self.fold_symbols == 3:
            # Like a flattened tree control using square headers
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN,    stc.STC_MARK_BOXMINUS,          "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDER,        stc.STC_MARK_BOXPLUS,           "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB,     stc.STC_MARK_VLINE,             "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL,    stc.STC_MARK_LCORNER,           "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND,     stc.STC_MARK_BOXPLUSCONNECTED,  "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
            self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER,           "white", "#808080")
        self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
        self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed)
        # Make some styles,  The lexer defines what each style is used for, we
        # just have to define what each style looks like.  This set is adapted from
        # Scintilla sample property files.
        # Global default styles for all languages
        self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
        self.StyleClearAll()  # Reset all to be like the default
        # Global default styles for all languages
        self.StyleSetSpec(stc.STC_STYLE_DEFAULT,     "face:%(helv)s,size:%(size)d" % faces)
        self.StyleSetSpec(stc.STC_STYLE_LINENUMBER,  "back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces)
        self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(other)s" % faces)
        #self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
        #self.StyleSetSpec(stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")
    leidnames={wx.stc.STC_H_DEFAULT: 'Default', wx.stc.STC_H_TAG: 'Tag', wx.stc.STC_H_TAGUNKNOWN: 'Tag unknown', wx.stc.STC_H_ATTRIBUTE: 'Attribute', wx.stc.STC_H_NUMBER: 'Number', wx.stc.STC_H_DOUBLESTRING: 'Double quoted string', wx.stc.STC_H_SINGLESTRING:'Single quoted string', wx.stc.STC_H_OTHER: 'Other inside tag', wx.stc.STC_H_COMMENT: 'Comment', wx.stc.STC_H_ENTITY: 'Entity', wx.stc.STC_H_TAGEND: 'Tag end', wx.stc.STC_H_XMLSTART: 'XML start', wx.stc.STC_H_XMLEND: 'XML End'}
    D:This is the section I have to define the styles for in order to work
    yles=['STC_H_ASP', 'STC_H_ASPAT', 'STC_H_ATTRIBUTE', 'STC_H_ATTRIBUTEUNKNOWN',
    TC_H_CDATA', 'STC_H_COMMENT', 'STC_H_DEFAULT', 'STC_H_DOUBLESTRING', 'STC_H_ENTITY',
    TC_H_NUMBER', 'STC_H_OTHER', 'STC_H_QUESTION', 'STC_H_SCRIPT', 'STC_H_SGML_1ST_PARAM',
    TC_H_SGML_1ST_PARAM_COMMENT', 'STC_H_SGML_BLOCK_DEFAULT', 'STC_H_SGML_COMMAND',
    C_H_SGML_COMMENT', 'STC_H_SGML_DEFAULT', 'STC_H_SGML_DOUBLESTRING', 'STC_H_SGML_ENTITY',
    C_H_SGML_ERROR', 'STC_H_SGML_SIMPLESTRING', 'STC_H_SGML_SPECIAL',
    C_H_SINGLESTRING', 'STC_H_TAG', 'STC_H_TAGEND', 'STC_H_TAGUNKNOWN',
    C_H_VALUE', 'STC_H_XCCOMMENT', 'STC_H_XMLEND', 'STC_H_XMLSTART']
        # XML styles, just taken from the above python sample
        # XML styles Mostly HTML styles
        # Default
        self.StyleSetSpec(stc.STC_H_DEFAULT, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
        # Comments
        self.StyleSetSpec(stc.STC_H_XCCOMMENT, "fore:#007F00,face:%(other)s,size:%(size)d" % faces)
        # Number
        self.StyleSetSpec(stc.STC_H_NUMBER, "fore:#007F7F,size:%(size)d" % faces)
        # String
        self.StyleSetSpec(stc.STC_H_ATTRIBUTE, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
        # Single quoted string
        self.StyleSetSpec(stc.STC_H_QUESTION, "fore:#7F007F,face:%(helv)s,size:%(size)d" % faces)
        # Keyword
        self.StyleSetSpec(stc.STC_H_ATTRIBUTEUNKNOWN, "fore:#00007F,bold,size:%(size)d" % faces)
        # Single quotes
        self.StyleSetSpec(stc.STC_H_SINGLESTRING, "fore:#7F0000,size:%(size)d" % faces)
        # double quotes
        self.StyleSetSpec(stc.STC_H_DOUBLESTRING, "fore:#7F0000,size:%(size)d" % faces)
        # Tag name definition
        self.StyleSetSpec(stc.STC_H_TAG, "fore:#0000FF,bold,size:%(size)d" % faces)
        # UnknownTag definition
        self.StyleSetSpec(stc.STC_H_TAGUNKNOWN, "fore:#007F7F,bold,size:%(size)d" % faces)
        # Operators
        self.StyleSetSpec(stc.STC_H_XMLSTART, "bold,size:%(size)d" % faces)
        # Identifiers
        self.StyleSetSpec(stc.STC_H_CDATA, "fore:#000000,face:%(helv)s,size:%(size)d" % faces)
        # Comment-blocks
        self.StyleSetSpec(stc.STC_H_COMMENT, "fore:#7F007F,underline,size:%(size)d" % faces)
        # End of line where string is not closed
        #self.StyleSetSpec(stc.STC_H_XMLEND, "fore:#000000,face:%(mono)s,size:%(size)d" % faces)
        self.SetCaretForeground("BLUE")
        self.SetCaretForeground("BLUE")
        # register some images for use in the AutoComplete box.
        self.RegisterImage(1, wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
        self.RegisterImage(2,
            wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16)))
        self.RegisterImage(3,
            wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16)))

def Bind(

self, event, handler, source=None, id=-1, id2=-1)

Bind an event to an event handler.

:param event: One of the `EVT_*` event binder objects that specifies the type of event to bind.

:param handler: A callable object to be invoked when the event is delivered to self. Pass `None` to disconnect an event handler.

:param source: Sometimes the event originates from a different window than self, but you still want to catch it in self. (For example, a button event delivered to a frame.) By passing the source of the event, the event handling system is able to differentiate between the same event type from different controls.

:param id: Used to spcify the event source by ID instead of instance.

:param id2: Used when it is desirable to bind a handler to a range of IDs, such as with EVT_MENU_RANGE.

Show source ≡

    def _EvtHandler_Bind(self, event, handler, source=None, id=wx.ID_ANY, id2=wx.ID_ANY):
        """
        Bind an event to an event handler.

        :param event: One of the ``EVT_*`` event binder objects that
                      specifies the type of event to bind.

        :param handler: A callable object to be invoked when the
                        event is delivered to self.  Pass ``None`` to
                        disconnect an event handler.

        :param source: Sometimes the event originates from a
                       different window than self, but you still
                       want to catch it in self.  (For example, a
                       button event delivered to a frame.)  By
                       passing the source of the event, the event
                       handling system is able to differentiate
                       between the same event type from different
                       controls.

        :param id: Used to spcify the event source by ID instead
                   of instance.

        :param id2: Used when it is desirable to bind a handler
                    to a range of IDs, such as with EVT_MENU_RANGE.
        """
        assert isinstance(event, wx.PyEventBinder)
        assert callable(handler) or handler is None
        assert source is None or hasattr(source, 'GetId')
        if source is not None:
            id  = source.GetId()
        event.Bind(self, id, id2, handler)

def ConvertDialogPointToPixels(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def ConvertDialogSizeToPixels(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def DLG_UNIT(

self, dlg_unit)

A convenience wrapper for :meth:`ConvertDialogToPixels`.

Show source ≡

    def _Window_DLG_UNIT(self, dlg_unit):
        """
        A convenience wrapper for :meth:`ConvertDialogToPixels`.
        """
        is_wxType = isinstance(dlg_unit, (wx.Size, wx.Point))
        pix = self.ConvertDialogToPixels(dlg_unit)
        if not is_wxType:
            pix = tuple(pix)
        return pix

def DestroyLater(

self)

Schedules the window to be destroyed in the near future.

This should be used whenever Destroy could happen too soon, such as when there may still be events for this window or its children waiting in the event queue.

Show source ≡

    def _Window_DestroyLater(self):
        """
        Schedules the window to be destroyed in the near future.

        This should be used whenever Destroy could happen too soon, such
        as when there may still be events for this window or its children
        waiting in the event queue.
        """
        self.Hide()
        wx.GetApp().ScheduleForDestruction(self)

def Expand(

self, line, doExpand, force=False, visLevels=0, level=-1)

Show source ≡

    def Expand(self, line, doExpand, force=False, visLevels=0, level=-1):
        lastChild = self.GetLastChild(line, level)
        line = line + 1
        while line <= lastChild:
            if force:
                if visLevels > 0:
                    self.ShowLines(line, line)
                else:
                    self.HideLines(line, line)
            else:
                if doExpand:
                    self.ShowLines(line, line)
            if level == -1:
                level = self.GetFoldLevel(line)
            if level & stc.STC_FOLDLEVELHEADERFLAG:
                if force:
                    if visLevels > 1:
                        self.SetFoldExpanded(line, True)
                    else:
                        self.SetFoldExpanded(line, False)
                    line = self.Expand(line, doExpand, force, visLevels-1)
                else:
                    if doExpand and self.GetFoldExpanded(line):
                        line = self.Expand(line, True, force, visLevels-1)
                    else:
                        line = self.Expand(line, False, force, visLevels-1)
            else:
                line = line + 1
        return line

def FoldAll(

self)

Show source ≡

    def FoldAll(self):
        lineCount = self.GetLineCount()
        expanding = True
        # find out if we are folding or unfolding
        for lineNum in range(lineCount):
            if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG:
                expanding = not self.GetFoldExpanded(lineNum)
                break
        lineNum = 0
        while lineNum < lineCount:
            level = self.GetFoldLevel(lineNum)
            if level & stc.STC_FOLDLEVELHEADERFLAG and \
               (level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE:
                if expanding:
                    self.SetFoldExpanded(lineNum, True)
                    lineNum = self.Expand(lineNum, True)
                    lineNum = lineNum - 1
                else:
                    lastChild = self.GetLastChild(lineNum, -1)
                    self.SetFoldExpanded(lineNum, False)
                    if lastChild > lineNum:
                        self.HideLines(lineNum+1, lastChild)
            lineNum = lineNum + 1

def GetPositionTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def GetSizeTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def GetVirtualSizeTuple(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def MoveXY(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def OnKeyPressed(

self, event)

Show source ≡

    def OnKeyPressed(self, event):
        if self.CallTipActive():
            self.CallTipCancel()
        key = event.GetKeyCode()
        if key == 32 and event.ControlDown():
            pos = self.GetCurrentPos()
            # Tips
            if event.ShiftDown():
                self.CallTipSetBackground("yellow")
                self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n'
                                 'show some suff, maybe parameters..\n\n'
                                 'fubar(param1, param2)')
            # Code completion
            else:
                #lst = []
                #for x in range(50000):
                #    lst.append('%05d' % x)
                #st = " ".join(lst)
                #print len(st)
                #self.AutoCompShow(0, st)
                kw = keyword.kwlist[:]
                kw.append("zzzzzz?2")
                kw.append("aaaaa?2")
                kw.append("__init__?3")
                kw.append("zzaaaaa?2")
                kw.append("zzbaaaa?2")
                kw.append("this_is_a_longer_value")
                #kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")
                kw.sort()  # Python sorts are case sensitive
                self.AutoCompSetIgnoreCase(False)  # so this needs to match
                # Images are specified with a appended "?type"
                for i in range(len(kw)):
                    if kw[i] in keyword.kwlist:
                        kw[i] = kw[i] + "?1"
                self.AutoCompShow(0, " ".join(kw))
        else:
            event.Skip()

def OnMarginClick(

self, evt)

Show source ≡

    def OnMarginClick(self, evt):
        # fold and unfold as needed
        if evt.GetMargin() == 2:
            if evt.GetShift() and evt.GetControl():
                self.FoldAll()
            else:
                lineClicked = self.LineFromPosition(evt.GetPosition())
                if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG:
                    if evt.GetShift():
                        self.SetFoldExpanded(lineClicked, True)
                        self.Expand(lineClicked, True, True, 1)
                    elif evt.GetControl():
                        if self.GetFoldExpanded(lineClicked):
                            self.SetFoldExpanded(lineClicked, False)
                            self.Expand(lineClicked, False, True, 0)
                        else:
                            self.SetFoldExpanded(lineClicked, True)
                            self.Expand(lineClicked, True, True, 100)
                    else:
                        self.ToggleFold(lineClicked)

def OnUpdateUI(

self, evt)

Show source ≡

    def OnUpdateUI(self, evt):
        # check for matching braces
        braceAtCaret = -1
        braceOpposite = -1
        charBefore = None
        caretPos = self.GetCurrentPos()
        if caretPos > 0:
            charBefore = self.GetCharAt(caretPos - 1)
            styleBefore = self.GetStyleAt(caretPos - 1)
        # check before
        if charBefore and chr(charBefore) in "[]{}()<>" and styleBefore == stc.STC_H_XMLSTART:
            braceAtCaret = caretPos - 1
        # check after
        if braceAtCaret < 0:
            charAfter = self.GetCharAt(caretPos)
            styleAfter = self.GetStyleAt(caretPos)
            if charAfter and chr(charAfter) in "[]{}()<>" and styleAfter == stc.STC_H_XMLEND:
                braceAtCaret = caretPos
        if braceAtCaret >= 0:
            braceOpposite = self.BraceMatch(braceAtCaret)
        if braceAtCaret != -1  and braceOpposite == -1:
            self.BraceBadLight(braceAtCaret)
        else:
            self.BraceHighlight(braceAtCaret, braceOpposite)

def PostCreate(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetClientRect(

self, rect)

Show source ≡

    def _Window_SetClientRect(self, rect):
        return self.SetClientSize(rect)

def SetDimensions(

*args, **kw)

SetDimensions(x, y, width, height, sizeFlags=SIZE_AUTO)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetRect(

self, rect)

Show source ≡

    def _Window_SetRect(self, rect):
        return self.SetSize(rect)

def SetSizeHintsSz(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetSizeWH(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetToolTipString(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def SetVirtualSizeWH(

*args, **kw)

Show source ≡

    def deprecated_func(*args, **kw):
        warnings.warn("Call to deprecated item%s. %s" % (name, msg),
                      wxPyDeprecationWarning, stacklevel=2)
        if not kw:
            return item(*args)
        return item(*args, **kw)

def Unbind(

self, event, source=None, id=-1, id2=-1, handler=None)

Disconnects the event handler binding for event from `self`. Returns `True` if successful.

Show source ≡

    def _EvtHandler_Unbind(self, event, source=None, id=wx.ID_ANY, id2=wx.ID_ANY, handler=None):
        """
        Disconnects the event handler binding for event from `self`.
        Returns ``True`` if successful.
        """
        if source is not None:
            id  = source.GetId()
        return event.Unbind(self, id, id2, handler)

### Instance variables

var AcceleratorTable

GetAcceleratorTable() -> AcceleratorTable

Gets the accelerator table for this window.

var AdditionalCaretForeground

GetAdditionalCaretForeground() -> Colour

Get the foreground colour of additional carets.

var AdditionalCaretsBlink

GetAdditionalCaretsBlink() -> bool

Whether additional carets will blink.

var AdditionalCaretsVisible

GetAdditionalCaretsVisible() -> bool

Whether additional carets are visible.

var AdditionalSelAlpha

GetAdditionalSelAlpha() -> int

Get the alpha of the selection.

var AdditionalSelectionTyping

GetAdditionalSelectionTyping() -> bool

Whether typing can be performed into multiple selections.

var AllLinesVisible

GetAllLinesVisible() -> bool

Are all lines visible?

var Anchor

GetAnchor() -> int

Returns the position of the opposite end of the selection to the caret.

var AutoLayout

GetAutoLayout() -> bool

Returns the sizer of which this window is a member, if any, otherwise NULL.

var BackSpaceUnIndents

GetBackSpaceUnIndents() -> bool

Does a backspace pressed when caret is within indentation unindent?

var BackgroundColour

GetBackgroundColour() -> Colour

Returns the background colour of the window.

var BackgroundStyle

GetBackgroundStyle() -> BackgroundStyle

Returns the background style of the window.

var BestSize

GetBestSize() -> Size

This functions returns the best acceptable minimal size for the window.

var BestVirtualSize

GetBestVirtualSize() -> Size

Return the largest of ClientSize and BestSize (as determined by a sizer, interior children, or other means)

var Border

GetBorder(flags) -> Border GetBorder() -> Border

Get the window border style from the given flags: this is different from simply doing flags & wxBORDER_MASK because it uses GetDefaultBorder() to translate wxBORDER_DEFAULT to something reasonable.

var BufferedDraw

GetBufferedDraw() -> bool

Is drawing done first into a buffer or direct to the screen?

var Caret

GetCaret() -> Caret

Returns the caret() associated with the window.

var CaretForeground

GetCaretForeground() -> Colour

Get the foreground colour of the caret.

var CaretLineBackAlpha

GetCaretLineBackAlpha() -> int

Get the background alpha of the caret line.

var CaretLineBackground

GetCaretLineBackground() -> Colour

Get the colour of the background of the line containing the caret.

var CaretLineVisible

GetCaretLineVisible() -> bool

Is the background of the line containing the caret in a different colour?

var CaretPeriod

GetCaretPeriod() -> int

Get the time in milliseconds that the caret is on and off.

var CaretSticky

GetCaretSticky() -> int

Can the caret preferred x position only be changed by explicit movement commands?

var CaretStyle

GetCaretStyle() -> int

Returns the current style of the caret.

var CaretWidth

GetCaretWidth() -> int

Returns the width of the insert mode caret.

var CharHeight

GetCharHeight() -> int

Returns the character height for this window.

var CharWidth

GetCharWidth() -> int

Returns the average character width for this window.

var CharacterPointer

GetCharacterPointer() -> PyObject

Compact the document buffer and return a read-only memoryview object of the characters in the document.

var Children

GetChildren() -> WindowList

Returns a reference to the list of the window's children.

var ClassInfo

GetClassInfo() -> ClassInfo

This virtual function is redefined for every class that requires run- time type information, when using the wxDECLARE_CLASS macro (or similar).

var ClassName

GetClassName() -> Char

Returns the class name of the C++ class using wxRTTI.

var ClientAreaOrigin

GetClientAreaOrigin() -> Point

Get the origin of the client area of the window relative to the window top left corner (the client area may be shifted because of the borders, scrollbars, other decorations...)

var ClientRect

GetClientRect() -> Rect

Get the client rectangle in window (i.e. client) coordinates.

var ClientSize

GetClientSize() -> Size

Returns the size of the window 'client area' in pixels.

var CodePage

GetCodePage() -> int

Get the code page used to interpret the bytes of the document as characters.

var Constraints

GetConstraints() -> LayoutConstraints

Returns a pointer to the window's layout constraints, or NULL if there are none.

var ContainingSizer

GetContainingSizer() -> Sizer

Returns the sizer of which this window is a member, if any, otherwise NULL.

var ControlCharSymbol

GetControlCharSymbol() -> int

Get the way control characters are displayed.

var CurLine

GetCurLine() -> (String, linePos)

Retrieve the text of the line containing the caret.

var CurLineRaw

GetCurLineRaw() -> (CharBuffer, linePos)

Retrieve the text of the line containing the caret.

var CurrentLine

GetCurrentLine() -> int

Returns the line number of the line with the caret.

var CurrentPos

GetCurrentPos() -> int

Returns the position of the caret.

var Cursor

GetCursor() -> Cursor

Return the cursor associated with this window.

var DefaultAttributes

GetDefaultAttributes() -> VisualAttributes

Currently this is the same as calling wxWindow::GetClassDefaultAttributes(wxWindow::GetWindowVariant()).

var DefaultStyle

GetDefaultStyle() -> TextAttr

Returns the style currently used for the new text.

var DocPointer

GetDocPointer() -> void

Retrieve a pointer to the document object.

var DropTarget

GetDropTarget() -> DropTarget

Returns the associated drop target, which may be NULL.

var EOLMode

GetEOLMode() -> int

Retrieve the current end of line mode - one of CRLF, CR, or LF.

var EdgeColour

GetEdgeColour() -> Colour

Retrieve the colour used in edge indication.

var EdgeColumn

GetEdgeColumn() -> int

Retrieve the column number which text should be kept within.

var EdgeMode

GetEdgeMode() -> int

Retrieve the edge highlight mode.

var EffectiveMinSize

GetEffectiveMinSize() -> Size

Merges the window's best size into the min size and returns the result.

var Enabled

IsEnabled() -> bool

Returns true if the window is enabled, i.e. if it accepts user input, false otherwise.

var EndAtLastLine

GetEndAtLastLine() -> bool

Retrieve whether the maximum scroll position has the last line at the bottom of the view.

var EndStyled

GetEndStyled() -> int

Retrieve the position of the last correctly styled character.

var EventHandler

GetEventHandler() -> EvtHandler

Returns the event handler for this window.

var EvtHandlerEnabled

GetEvtHandlerEnabled() -> bool

Returns true if the event handler is enabled, false otherwise.

var ExtraAscent

GetExtraAscent() -> int

Get extra ascent for each line.

var ExtraDescent

GetExtraDescent() -> int

Get extra descent for each line.

var ExtraStyle

GetExtraStyle() -> long

Returns the extra style bits for the window.

var FirstVisibleLine

GetFirstVisibleLine() -> int

Retrieve the display line at the top of the display.

var Font

GetFont() -> Font

Returns the font for this window.

var ForegroundColour

GetForegroundColour() -> Colour

Returns the foreground colour of the window.

var GapPosition

GetGapPosition() -> int

Return a position which, to avoid performance costs, should not be within the range of a call to GetRangePointer.

var GrandParent

GetGrandParent() -> Window

Returns the grandparent of a window, or NULL if there isn't one.

var Handle

GetHandle() -> UIntPtr

Returns the platform-specific handle of the physical window.

var HelpText

GetHelpText() -> String

Gets the help text to be used as context-sensitive help for this window.

var HighlightGuide

GetHighlightGuide() -> int

Get the highlighted indentation guide column.

var Hint

GetHint() -> String

Returns the current hint string.

var HotspotActiveBackground

GetHotspotActiveBackground() -> Colour

Get the back colour for active hotspots.

var HotspotActiveForeground

GetHotspotActiveForeground() -> Colour

Get the fore colour for active hotspots.

var HotspotActiveUnderline

GetHotspotActiveUnderline() -> bool

Get whether underlining for active hotspots.

var HotspotSingleLine

GetHotspotSingleLine() -> bool

Get the HotspotSingleLine property.

var Id

GetId() -> WindowID

Returns the identifier of the window.

var Identifier

GetIdentifier() -> int

Get the identifier.

var Indent

GetIndent() -> int

Retrieve indentation size.

var IndentationGuides

GetIndentationGuides() -> int

Are the indentation guides visible?

var IndicatorCurrent

GetIndicatorCurrent() -> int

Get the current indicator.

var IndicatorValue

GetIndicatorValue() -> int

Get the current indicator value.

var InsertionPoint

GetInsertionPoint() -> long

Returns the insertion point, or cursor, position.

var KeysUnicode

GetKeysUnicode() -> bool

Are keys always interpreted as Unicode?

var Label

GetLabel() -> String

Returns the control's label, as it was passed to SetLabel().

var LabelText

GetLabelText() -> String GetLabelText(label) -> String

Returns the control's label without mnemonics.

var LastKeydownProcessed

GetLastKeydownProcessed() -> bool

Can be used to prevent the EVT_CHAR handler from adding the char.

var LastPosition

GetLastPosition() -> long

Returns the zero based index of the last position in the text control, which is equal to the number of characters in the control.

var LayoutCache

GetLayoutCache() -> int

Retrieve the degree of caching of layout information.

var LayoutDirection

GetLayoutDirection() -> LayoutDirection

Returns the layout direction for this window, Note that wxLayout_Default is returned if layout direction is not supported.

var Length

GetLength() -> int

Returns the number of bytes in the document.

var Lexer

GetLexer() -> int

Retrieve the lexing language of the document.

var LineCount

GetLineCount() -> int

Returns the number of lines in the document.

var MainSelection

GetMainSelection() -> int

Which selection is the main selection.

var MarginLeft

GetMarginLeft() -> int

Returns the size in pixels of the left margin.

var MarginOptions

GetMarginOptions() -> int

Get the margin options.

var MarginRight

GetMarginRight() -> int

Returns the size in pixels of the right margin.

var Margins

GetMargins() -> Point

Returns the margins used by the control.

var MaxClientSize

GetMaxClientSize() -> Size

Returns the maximum size of window's client area.

var MaxHeight

GetMaxHeight() -> int

Returns the vertical component of window maximal size.

var MaxLineState

GetMaxLineState() -> int

Retrieve the last line number that has line state.

var MaxSize

GetMaxSize() -> Size

Returns the maximum size of the window.

var MaxWidth

GetMaxWidth() -> int

Returns the horizontal component of window maximal size.

var MinClientSize

GetMinClientSize() -> Size

Returns the minimum size of window's client area, an indication to the sizer layout mechanism that this is the minimum required size of its client area.

var MinHeight

GetMinHeight() -> int

Returns the vertical component of window minimal size.

var MinSize

GetMinSize() -> Size

Returns the minimum size of the window, an indication to the sizer layout mechanism that this is the minimum required size.

var MinWidth

GetMinWidth() -> int

Returns the horizontal component of window minimal size.

var ModEventMask

GetModEventMask() -> int

Get which document modification events are sent to the container.

var Modify

GetModify() -> bool

Is the document different from when it was last saved?

var MouseDownCaptures

GetMouseDownCaptures() -> bool

Get whether mouse gets captured.

var MouseDwellTime

GetMouseDwellTime() -> int

Retrieve the time the mouse must sit still to generate a mouse dwell event.

var MultiPaste

GetMultiPaste() -> int

Retrieve the effect of pasting when there are multiple selections.

var MultipleSelection

GetMultipleSelection() -> bool

Whether multiple selections can be made.

var Name

GetName() -> String

Returns the window's name.

var NextHandler

GetNextHandler() -> EvtHandler

Returns the pointer to the next handler in the chain.

var NumberOfLines

GetNumberOfLines() -> int

var Overtype

GetOvertype() -> bool

Returns true if overtype mode is active otherwise false is returned.

var Parent

GetParent() -> Window

Returns the parent of the window, or NULL if there is no parent.

var PasteConvertEndings

GetPasteConvertEndings() -> bool

Get convert-on-paste setting.

var Position

GetPosition() -> Point

This gets the position of the window in pixels, relative to the parent window for the child windows or relative to the display origin for the top level windows.

var PositionCacheSize

GetPositionCacheSize() -> int

How many entries are allocated to the position cache?

var PreviousHandler

GetPreviousHandler() -> EvtHandler

Returns the pointer to the previous handler in the chain.

var PrintColourMode

GetPrintColourMode() -> int

Returns the print colour mode.

var PrintMagnification

GetPrintMagnification() -> int

Returns the print magnification.

var PrintWrapMode

GetPrintWrapMode() -> int

Is printing line wrapped?

var PunctuationChars

GetPunctuationChars() -> String

Get the set of characters making up punctuation characters.

var RangePointer

GetRangePointer(position, rangeLength) -> PyObject

Return a read-only pointer to a range of characters in the document. May move the gap so that the range is contiguous, but will only move up to rangeLength bytes.

var ReadOnly

GetReadOnly() -> bool

In read-only mode?

var Rect

GetRect() -> Rect

Returns the position and size of the window as a wxRect object.

var RectangularSelectionAnchor

GetRectangularSelectionAnchor() -> int

var RectangularSelectionAnchorVirtualSpace

GetRectangularSelectionAnchorVirtualSpace() -> int

var RectangularSelectionCaret

GetRectangularSelectionCaret() -> int

var RectangularSelectionCaretVirtualSpace

GetRectangularSelectionCaretVirtualSpace() -> int

var RectangularSelectionModifier

GetRectangularSelectionModifier() -> int

Get the modifier key used for rectangular selection.

var RefData

GetRefData() -> ObjectRefData

Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.

var STCCursor

GetSTCCursor() -> int

Get cursor type.

var STCFocus

GetSTCFocus() -> bool

Get internal focus flag.

var ScreenPosition

GetScreenPosition() -> Point

Returns the window position in screen coordinates, whether the window is a child window or a top level one.

var ScreenRect

GetScreenRect() -> Rect

Returns the position and size of the window on the screen as a wxRect object.

var ScrollWidth

GetScrollWidth() -> int

Retrieve the document width assumed for scrolling.

var ScrollWidthTracking

GetScrollWidthTracking() -> bool

Retrieve whether the scroll width tracks wide lines.

var SearchFlags

GetSearchFlags() -> int

Get the search flags used by SearchInTarget.

var SelAlpha

GetSelAlpha() -> int

Get the alpha of the selection.

var SelEOLFilled

GetSelEOLFilled() -> bool

Is the selection end of line filled?

var SelectedText

GetSelectedText() -> String

Retrieve the selected text.

var SelectedTextRaw

GetSelectedTextRaw() -> CharBuffer

Retrieve the selected text.

var SelectionEnd

GetSelectionEnd() -> int

Returns the position at the end of the selection.

var SelectionMode

GetSelectionMode() -> int

Get the mode of the current selection.

var SelectionStart

GetSelectionStart() -> int

Returns the position at the start of the selection.

var Selections

GetSelections() -> int

How many selections are there?

var Shown

IsShown() -> bool

Returns true if the window is shown, false if it has been hidden.

var Size

GetSize() -> Size

Returns the size of the entire window in pixels, including title bar, border, scrollbars, etc.

var Sizer

GetSizer() -> Sizer

Returns the sizer associated with the window by a previous call to SetSizer(), or NULL.

var Status

GetStatus() -> int

Get error status.

var StringSelection

GetStringSelection() -> String

Gets the text currently selected in the control.

var StyleBits

GetStyleBits() -> int

Retrieve number of bits in style bytes used to hold the lexical state.

var StyleBitsNeeded

GetStyleBitsNeeded() -> int

Retrieve the number of bits the current lexer needs for styling.

var TabIndents

GetTabIndents() -> bool

Does a tab pressed when caret is within indentation indent?

var TabWidth

GetTabWidth() -> int

Retrieve the visible size of a tab.

var TargetEnd

GetTargetEnd() -> int

Get the position that ends the target.

var TargetStart

GetTargetStart() -> int

Get the position that starts the target.

var Technology

GetTechnology() -> int

Get the tech.

var Text

GetText() -> String

Retrieve all the text in the document.

var TextLength

GetTextLength() -> int

Retrieve the number of characters in the document.

var TextRaw

GetTextRaw() -> CharBuffer

Retrieve all the text in the document.

var ThemeEnabled

GetThemeEnabled() -> bool

Clears the window by filling it with the current background colour.

var ToolTip

GetToolTip() -> ToolTip

Get the associated tooltip or NULL if none.

var TopLevel

IsTopLevel() -> bool

Returns true if the given window is a top-level one.

var TopLevelParent

GetTopLevelParent() -> Window

Returns the first ancestor of this window which is a top-level window.

var TwoPhaseDraw

GetTwoPhaseDraw() -> bool

Is drawing done in two phases with backgrounds drawn before foregrounds?

var UndoCollection

GetUndoCollection() -> bool

Is undo history being collected?

var UpdateClientRect

GetUpdateClientRect() -> Rect

Get the update rectangle bounding box in client coords.

var UpdateRegion

GetUpdateRegion() -> Region

Returns the region specifying which parts of the window have been damaged.

var UseHorizontalScrollBar

GetUseHorizontalScrollBar() -> bool

Is the horizontal scroll bar visible?

var UseTabs

GetUseTabs() -> bool

Retrieve whether tabs will be used in indentation.

var UseVerticalScrollBar

GetUseVerticalScrollBar() -> bool

Is the vertical scroll bar visible?

var Validator

GetValidator() -> Validator

Validator functions.

var Value

GetValue() -> String

Gets the contents of the control.

var ViewEOL

GetViewEOL() -> bool

Are the end of line characters visible?

var ViewWhiteSpace

GetViewWhiteSpace() -> int

Are white space characters currently visible? Returns one of SCWS_* constants.

var VirtualSize

GetVirtualSize() -> Size

This gets the virtual size of the window in pixels.

var VirtualSpaceOptions

GetVirtualSpaceOptions() -> int

var WhitespaceChars

GetWhitespaceChars() -> String

Get the set of characters making up whitespace for when moving or selecting by word.

var WhitespaceSize

GetWhitespaceSize() -> int

Get the size of the dots used to mark space characters.

var WindowStyle

GetWindowStyle() -> long

See GetWindowStyleFlag() for more info.

var WindowStyleFlag

GetWindowStyleFlag() -> long

Gets the window style that was passed to the constructor or Create() method.

var WindowVariant

GetWindowVariant() -> WindowVariant

Returns the value previously passed to SetWindowVariant().

var WordChars

GetWordChars() -> String

Get the set of characters making up words for when moving or selecting by word.

var WrapIndentMode

GetWrapIndentMode() -> int

Retrieve how wrapped sublines are placed.

var WrapMode

GetWrapMode() -> int

Retrieve whether text is word wrapped.

var WrapStartIndent

GetWrapStartIndent() -> int

Retrive the start indent for wrapped lines.

var WrapVisualFlags

GetWrapVisualFlags() -> int

Retrive the display mode of visual flags for wrapped lines.

var WrapVisualFlagsLocation

GetWrapVisualFlagsLocation() -> int

Retrive the location of visual flags for wrapped lines.

var XOffset

GetXOffset() -> int

var Zoom

GetZoom() -> int

Retrieve the zoom level.

## Module variables

var demoText

var faces

var overview

var wxID_STYLEDTEXTCTRLPANEL

var wxID_STYLEDTEXTCTRLPANELSTYLEDTEXTCTRL1