def _get_selection_range(self):
        """
        Return the index of the currently selected text.
        :return: start and end index of the currently selected text
        :rtype: tuple of (int, int)
        """
        # based on: https://stackoverflow.com/questions/4073468/how-do-i-get-a-selected-string-in-from-a-tkinter-text-box
        # check if text is selected
        if not self._txt.tag_ranges(tkinter.SEL):
            return None, None
        raw_start = self._txt.index(tkinter.SEL_FIRST)
        raw_end = self._txt.index(tkinter.SEL_LAST)
        si = self._tk_index_to_tuple(raw_start)
        ei = self._tk_index_to_tuple(raw_end)
        rsi = self._abs_cursor_pos_to_rel_pos(si)
        rei = self._abs_cursor_pos_to_rel_pos(ei)
        return rsi, rei

        Return the index of the currently selected text.
        :return: start and end index of the currently selected text
        :rtype: tuple of (int, int)
        
system/shui/tkui.py