[Pythonmac-SIG] Re: Pythonmac-SIG digest, Vol 1 #222 - 2 msgs
Jack Jansen
jack@oratrix.nl
Wed, 18 Aug 1999 18:09:53 +0200
> could anyone give me an idea on how to access the clipboard
>
> what I want to do is copy something to the clipboard and when I activate my
> program it reads it and mods it
>
>
> example:
>
> getclipboard(text)
> read(text)
The Scrap module is what you need. The quick way to use it is:
- Putting stuff in:
Scrap.ZeroScrap()
Scrap.PutScrap("TEXT", "Hello World")
- Getting stuff out:
h = Res.Resource("")
Scrap.GetScrap(h, "TEXT")
print "Clipboard contains:", h.data
The rather strange interface is because it is more-or-less a straight mapping
of the C interface to Python. (Or, in other words, see Inside Mac for more use
cases).
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm