def copy_to_clipboard(text_editor: TextEditor): r = Tk() r.withdraw() r.clipboard_clear() r.clipboard_append(text_editor.selection_get()) r.update() r.destroy()
def cut_to_clipboard(text_editor: TextEditor): r = Tk() r.withdraw() r.clipboard_clear() r.clipboard_append(text_editor.selection_get()) r.update() r.destroy() text_editor.delete(SEL_FIRST, SEL_LAST)