Tkinter Text widget. Unselect text

Viewed 2249

I have used a Text widget with Tkinter that copies selected text to the clipboard when a button is pressed. Now after the copy process I would like to unselect the text. Any idea how that might work?

Since it seems to be necessary to post some code, for people to understand my problem in more detail, here it is:

def copy_to_clipboard(self, copy_string):
    #copy to clipboard function
    self.clipboard_clear()
    try:
        #text in outputlistfield marked, so copy that
        self.clipboard_append(self.outputlistfield.get("sel.first", "sel.last"))
    except:
        #no text marked

outputlistfield is a Text widget. If Text is selected, it shall be copied to clipboard. That works fine. But I would like to reset the selection, so that after the text is copied no text is selected anymore. So, any suggestions?

2 Answers
Related