(self, event)
return "break"
Replace the current word with the next expansion.
Replace the current word with the next expansion.
Replace the current word with the next expansion .
def expand_word_event(self, event):
        "Replace the current word with the next expansion."
        curinsert = self.text.index("insert")
        curline = self.text.get("insert linestart", "insert lineend")
        if not self.state:
            words = self.getwords()
            index = 0
        else:
            words, index, insert, line = self.state
            if insert != curinsert or line != curline:
                words = self.getwords()
                index = 0
        if not words:
            self.bell()
            return "break"
        word = self.getprevword()
        self.text.delete("insert - %d chars" % len(word), "insert")
        newword = words[index]
        index = (index + 1) % len(words)
        if index == 0:
            self.bell()            # Warn we cycled around
        self.text.insert("insert", newword)
        curinsert = self.text.index("insert")
        curline = self.text.get("insert linestart", "insert lineend")
        self.state = words, index, curinsert, curline
        return "break"
def expand_word_event ( self , event ) : curinsert = self . text . index ( "insert" ) curline = self . text . get ( "insert linestart" , "insert lineend" ) if not self . state : words = self . getwords ( ) index = 0 else : words , index , insert , line = self . state if insert != curinsert or line != curline : words = self . getwords ( ) index = 0 if not words : self . bell ( ) return "break" word = self . getprevword ( ) self . text . delete ( "insert - %d chars" % len ( word ) , "insert" ) newword = words [ index ] index = ( index + 1 ) % len ( words ) if index == 0 : self . bell ( ) # Warn we cycled around self . text . insert ( "insert" , newword ) curinsert = self . text . index ( "insert" ) curline = self . text . get ( "insert linestart" , "insert lineend" ) self . state = words , index , curinsert , curline return "break"