cross-platform clipboard module

Hey guys,

I was thinking “My DirectEntry’s should have copy and paste!” so I set out in the past hour to build a cross-platform clipboard module.

I came out with one supporting windows, linux (through xclip or xsel, you must have one of these), and mac (untested, I have no mac, if someone with a mac find’s problems please contact me)(through pbcopy and pbpaste)

You can download it here
License: Apache v2.0 License

Copy the whole “clipboard” folder into your project.
Then use something like this:

from clipboard import clipboard
c = clipboard.clipboard()
print 'Your current clip:', c.get()
c.put('Hello world, set by the clipboard module')
print 'After setting the clip:', c.get()
print 'Done!'

Annd well you get the point. :wink:
Enjoy it.
~powerpup118

EDIT: forgot import line, fixed now
EDIT2: Fixed import statements for p3d files

Wow this is cool. Will use this!

Thread bookmarked. :slight_smile:
Thanks

Very nice, thanks :slight_smile:

Nice, nice

download link broken

My largest apologies. Download link fixed.

(I was toying with upgrading the site, and forgot to upload the downloads back onto it, it’s all good now :wink: )
~powerpup118

Hey guys, I updated the zip file and changed a few lines inside the code:
(File: win32_clipboard.py)

from pyreadline.keysyms.winconstants import ...
from pyreadline.unicode_helper import ...

to this:

from winconstants import ...
from unicode_helper import ...

This fixes a few problems specifically with including this code inside your p3d files, so if you experience problems using this module in your p3d files, then download the zip file again (it’s updated) and it should work now.

Lemme know if you’ve any troubles,
~powerpup118

This would be useful, but I can’t download it now, either from the original link, or from a modified link whose host is lightpoke.dyndns.org. My browser says it can’t find the server. Can you or anyone provide a working link?

(Also I’m wondering if you have released it under an open-source license like BSD.)

Thanks,
Bruce Smith

Hi, You’re totally correct, my website is offline for now, I’ve uploaded the clipboard.zip file to my google site, so it’s a more permanent solution.

License: Apache v2.0 License

(It’s basically just BSD with a small modification saying I’m non-liable for you injuring yourself with it or the such, let me know if you’d prefer a different license instead, I’ve also updated the main post with the proper link)

Thanks, but where is your google site? (Googling your username found me a lot of sites, but I’m not sure which ones to look in.)

Apache license is fine – it also says (roughly) (I think) that you grant me any patent rights I might need (which you have the power to grant me) to use the code.

About the license: yeah, I guess it’s more of a ‘commercial’ type open source license, it’s just my preference is all, no particular reason by any means

About the link: I am sorry! I thought it would have been obvious , I guess I kind of sometimes expect people to read my mind, my apologies very much!

The link in the main post was updated, so that it points to the correct download :wink:

Let me know should you have any problems,

~powerpup118

No problem, and thanks again for providing it.