[Pythonmac-SIG] Copying to clipboard (pasteboard)

Jeremy Conlin jeremyconlin at mail.weber.edu
Thu Mar 24 15:57:54 CET 2005


> I figured out how to do this with a lot of trial and error.  You can 
> use Carbon or AppKit/Foundation.
>
> -------------------------------------------------
> import Carbon.Scrap, AppKit, Foundation
>
> def clipcopy(arg):
> 	Carbon.Scrap.ClearCurrentScrap()
> 	scrap = Carbon.Scrap.GetCurrentScrap()
> 	scrap.PutScrapFlavor('TEXT', 0, arg)
>
>

That worked!  Thanks a bunch.
(Now I get to show what kind of a newbie I am.)  Why should I put this 
into a class?  Is it just better programming practice?  I suppose the 
answer may depend on what the script does and how complicated it is.

Also, where can I find documentation on this?  I tried Python's help, 
but it offered very little.
Thanks,
Jeremy



More information about the Pythonmac-SIG mailing list