# :mod:pygame.scrap

EXPERIMENTAL!: meaning this api may change, or dissapear in later pygame releases. If you use this, your code will break with the next pygame release.

The scrap module is for getting and putting stuff from the clipboard. So you can copy and paste things between pygame, and other application types. It defines some basic own data types

SCRAP_PPM
SCRAP_PBM
SCRAP_BMP
SCRAP_TEXT


to be placed into the clipboard and allows to use define own clipboard types. SCRAP_PPM, SCRAP_PBM and SCRAP_BMP are suitable for surface buffers to be shared with other applications, while SCRAP_TEXT is an alias for the plain text clipboard type.

The SCRAP_* types refer to the following MIME types and register those as well as the default operating system type for this type of data:

SCRAP_TEXT text/plain    for plain text
SCRAP_PBM  image/pbm     for PBM encoded image data
SCRAP_PPM  image/ppm     for PPM encoded image data
SCRAP_BMP  image/bmp     for BMP encoded image data


Depending on the platform additional types are automatically registered when data is placed into the clipboard to guarantee a consistent sharing behaviour with other applications. The following listed types can be used as string to be passed to the respective :mod:pygame.scrap module functions.

For Windows platforms, the additional types are supported automatically and resolve to their internal definitions:

text/plain;charset=utf-8 for UTF-8 encoded text
audio/wav                for WAV encoded audio
image/tiff               for TIFF encoded image data


For X11 platforms, the additional types are supported automatically and resolve to their internal definitions:

UTF8_STRING               for UTF-8 encoded text
text/plain;charset=utf-8  for UTF-8 encoded text
COMPOUND_TEXT             for COMPOUND text


As stated before you can define own types for the clipboard, those however might not be usable by other applications. Thus data pasted into the clipboard using

pygame.scrap.put ("own_data", data)


can only be used by applications, which query the clipboard for the "own_data" type.

New in pygame 1.8. Only works for Windows, X11 and Mac OS X so far. On Mac OSX only text works at the moment - other types will be supported in the next release.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.