code: def copy_to_clipboard(self):
          
          tree = self.treeview
          # get the selected item:
          selection = tree.selection()
          if selection:
              self.filter_remove(remember=True)
              root = ET.Element('selection')
              for item in selection:
                  node = self.tree_node_to_xml('', item)
                  root.append(node)
              # python2 issue
              try:
                  text = ET.tostring(root, encoding='unicode')
              except LookupError:
                  text = ET.tostring(root, encoding='UTF-8')
              tree.clipboard_clear()
              tree.clipboard_append(text)
              self.filter_restore()
docs: Copies selected items to clipboard.