(self, text, prog=None, ok=0)
return res
Return (lineno, matchobj) or None for forward/backward search.

        This function calls the right function with the right arguments.
        It directly return the result of that call.

        Text is a text widget. Prog is a precompiled pattern.
        The ok parameter is a bit complicated as it has two effects.

        If there is a selection, the search begin at either end,
        depending on the direction setting and ok, with ok meaning that
        the search starts with the selection. Otherwise, search begins
        at the insert mark.

        To aid progress, the search functions do not return an empty
        match at the starting position unless ok is True.
Return (lineno, matchobj) or None for forward/backward search.
Return ( lineno matchobj ) or None for forward / backward search .
def search_text(self, text, prog=None, ok=0):
        '''Return (lineno, matchobj) or None for forward/backward search.

        This function calls the right function with the right arguments.
        It directly return the result of that call.

        Text is a text widget. Prog is a precompiled pattern.
        The ok parameter is a bit complicated as it has two effects.

        If there is a selection, the search begin at either end,
        depending on the direction setting and ok, with ok meaning that
        the search starts with the selection. Otherwise, search begins
        at the insert mark.

        To aid progress, the search functions do not return an empty
        match at the starting position unless ok is True.
        '''

        if not prog:
            prog = self.getprog()
            if not prog:
                return None # Compilation failed -- stop
        wrap = self.wrapvar.get()
        first, last = get_selection(text)
        if self.isback():
            if ok:
                start = last
            else:
                start = first
            line, col = get_line_col(start)
            res = self.search_backward(text, prog, line, col, wrap, ok)
        else:
            if ok:
                start = first
            else:
                start = last
            line, col = get_line_col(start)
            res = self.search_forward(text, prog, line, col, wrap, ok)
        return res
def search_text ( self , text , prog = None , ok = 0 ) : if not prog : prog = self . getprog ( ) if not prog : return None # Compilation failed -- stop wrap = self . wrapvar . get ( ) first , last = get_selection ( text ) if self . isback ( ) : if ok : start = last else : start = first line , col = get_line_col ( start ) res = self . search_backward ( text , prog , line , col , wrap , ok ) else : if ok : start = first else : start = last line , col = get_line_col ( start ) res = self . search_forward ( text , prog , line , col , wrap , ok ) return res