question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add cross-platform clipboard support on Tableview

See original GitHub issue

Add option to copy selection to clipboard.

A code example (maybe there are other better ways), I don’t know what it’s like on Windows and Mac. But on Linux you need to use pyperclip to keep the data on the clipboard after closing the program. And on linux you also need to do this ‘update()’ twice and need the return 'break'

example:

import pyperclip

def tvw_item_ckick(self, event=None):
    self.tvw.selection()
    str_all_columns = ''
    for n in self.tvw.selection():
        str_columns = '\t'.join(self.tvw.item(n, 'values'))
        str_all_columns += f'''{str_columns}\n'''

    self.clipboard_clear()
    self.update()

    try:
        pyperclip.copy(str_all_columns)
    except TclError as e:
        raise e
    
    self.update()
    return 'break'

self.tvw.bind('<Control-c>', self.tvw_item_ckick)
self.tvw.bind('<Control-C>', self.tvw_item_ckick)

_Originally posted by @antrrax in https://github.com/israel-dryer/ttkbootstrap/issues/114#issuecomment-1004099982_

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
israel-dryercommented, Jan 3, 2022

Adding for reference: https://bugs.python.org/issue40452

0reactions
antrraxcommented, Jan 26, 2022

On Ubuntu/mint need to install xclip and xsel. But as it is something that is used frequently, it is already in my system post installation script, so I forget that it doesn’t come with the vanilla system.

Read more comments on GitHub >

github_iconTop Results From Across the Web

copy data from tableview to clipboard | B4X Programming Forum
Looking for recommendation on how to copy data from tableview w/wo headers ... B4X is a set of simple and powerful cross platform...
Read more >
Clipboard - .NET MAUI | Microsoft Learn
This article describes how you can use the .NET Multi-platform App UI (.NET MAUI) IClipboard interface. With this interface, you can copy and ......
Read more >
Copy entire grid control / table view content to clipboard with ...
Copy entire grid control / table view content to clipboard with table header context menu function · Answers approved by DevExpress Support.
Read more >
Titanium SDK 10.0.0.GA - 17 May 2021
Use the cross-platform Ti.UI.Toolbar instead. Ti.UI.TabGroup#getActiveTab(), Use the Ti.UI.TabGroup.activeTab property instead ...
Read more >
Qt model view and cut copy paste - Srivats P
Note: Most of Ostinato's views (that support copy-paste) are ... I created a singleton ClipboardHelper class, added the actions as private ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found