def on_clipboard(self, button):
kwargs = dict()
text = self.clipboard.wait_for_text()
lines = text[:10000].split('\n')[:-1][:10]
counts = set([x.lstrip().count('\t') for x in lines])
if len(lines) > 1 and len(counts) == 1 and counts.pop() != 0:
kwargs['sep'] = '\t'
if kwargs.get('sep') is None and kwargs.get('delim_whitespace') is None:
kwargs['sep'] = '\s+'
try:
self.data = pd.read_table(StringIO(text), **kwargs)
except:
print("Unexpected Error: ", sys.exc_info())
else:
self.verticalbox.remove(self.scrollable_treelist)
self.add_treeview()
评论列表
文章目录