Reputation: 1338
I have this code to enable CTRL+C copy on the selected contents of a tkinter.ttk treeview:
def Copy(event):
'''
Copies the selected treeview items to the
clipboard. Includes Column numbers.
'''
selectedRows = []
selectedRows.append(self.maindata.columns)
for i in self.tree.selection():
selectedRows.append(self.tree.item(i)['values'])
d = pd.DataFrame(selectedRows)
d.to_clipboard(index=False)
self.tree.bind("<Control-Key-c>", Copy)
This was working fine in plan text.py files executed in IDLE but I'm using the Liclipse IDE for a more confortable debugging experience now and I get the error:
Exception in Tkinter callback
Traceback (most recent call last):
File "E:\Programming\Anaconda3_4.2.0\lib\tkinter\__init__.py", line 1550, in __call__
return self.func(*args)
File "E:\Programming\EclipseWorkspace\AssetManager\workingTreeview.py", line 90, in Copy
d.to_clipboard(index=False)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\pandas\core\generic.py", line 1202, in to_clipboard
clipboard.to_clipboard(self, excel=excel, sep=sep, **kwargs)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\pandas\io\clipboard.py", line 98, in to_clipboard
clipboard_set(objstr)
File "E:\Programming\Anaconda3_4.2.0\lib\site-packages\pandas\util\clipboard.py", line 85, in _copyWindows
ctypes.cdll.msvcrt.wcscpy(ctypes.c_wchar_p(pchData), text)
OSError: exception: access violation writing 0x0000000000000000
Can anyone explain why this is happening and what I need to do to fix it?
Upvotes: 0
Views: 1213