(self, edge_index)
return move_at_edge
Cursor move begins at start or end of selection

        When a left/right cursor key is pressed create and return to Tkinter a
        function which causes a cursor move from the associated edge of the
        selection.
Cursor move begins at start or end of selection
Cursor move begins at start or end of selection
def move_at_edge_if_selection(self, edge_index):
        """Cursor move begins at start or end of selection

        When a left/right cursor key is pressed create and return to Tkinter a
        function which causes a cursor move from the associated edge of the
        selection.

        """
        self_text_index = self.text.index
        self_text_mark_set = self.text.mark_set
        edges_table = ("sel.first+1c", "sel.last-1c")
        def move_at_edge(event):
            if (event.state & 5) == 0: # no shift(==1) or control(==4) pressed
                try:
                    self_text_index("sel.first")
                    self_text_mark_set("insert", edges_table[edge_index])
                except TclError:
                    pass
        return move_at_edge
def move_at_edge_if_selection ( self , edge_index ) : self_text_index = self . text . index self_text_mark_set = self . text . mark_set edges_table = ( "sel.first+1c" , "sel.last-1c" ) def move_at_edge ( event ) : if ( event . state & 5 ) == 0 : # no shift(==1) or control(==4) pressed try : self_text_index ( "sel.first" ) self_text_mark_set ( "insert" , edges_table [ edge_index ] ) except TclError : pass return move_at_edge