word_count.py
def _on_partial_result(self, asr, hyp):
        """Delete any previous selection, insert text and select it."""
        Gdk.threads_enter()
        # All this stuff appears as one single action
        self.textbuf.begin_user_action()
        self.textbuf.delete_selection(True, self.text.get_editable())
        self.textbuf.insert_at_cursor(hyp)
        ins = self.textbuf.get_insert()
        iter = self.textbuf.get_iter_at_mark(ins)
        iter.backward_chars(len(hyp))
        self.textbuf.move_mark(ins, iter)
        self.textbuf.end_user_action()    
        Gdk.threads_leave()
Delete any previous selection, insert text and select it.
Delete any previous selection, insert text and select it.
Delete any previous selection insert text and select it .
def _on_partial_result(self, asr, hyp):
        Gdk.threads_enter()
        self.textbuf.begin_user_action()
        self.textbuf.delete_selection(True, self.text.get_editable())
        self.textbuf.insert_at_cursor(hyp)
        ins = self.textbuf.get_insert()
        iter = self.textbuf.get_iter_at_mark(ins)
        iter.backward_chars(len(hyp))
        self.textbuf.move_mark(ins, iter)
        self.textbuf.end_user_action()    
        Gdk.threads_leave()
def _on_partial_result ( self , asr , hyp ) : Gdk . threads_enter ( ) self . textbuf . begin_user_action ( ) self . textbuf . delete_selection ( True , self . text . get_editable ( ) ) self . textbuf . insert_at_cursor ( hyp ) ins = self . textbuf . get_insert ( ) iter = self . textbuf . get_iter_at_mark ( ins ) iter . backward_chars ( len ( hyp ) ) self . textbuf . move_mark ( ins , iter ) self . textbuf . end_user_action ( ) Gdk . threads_leave ( )
Delete any previous selection, insert text and select it.
Delete any previous selection insert text and select it .
"""Delete any previous selection, insert text and select it.""" # All this stuff appears as one single action
self
asr
hyp