Inheritance diagram for wx.Clipboard:
A class for manipulating the clipboard.
To use the clipboard, you call member functions of the global wx.TheClipboard object.
Call Open to get ownership of the clipboard. If this operation returns True, you now own the clipboard. Call SetData to put data on the clipboard, or GetData to retrieve data from the clipboard. Call Close to close the clipboard and relinquish ownership.
You should keep the clipboard open only momentarily.
For example:
# Try to open the clipboard...
if wx.TheClipboard.Open():
# Create a wx.TextDataObject
do = wx.TextDataObject()
do.SetText("Hello from wxPython!")
# Add the data to the clipboard
wx.TheClipboard.SetData(do)
# Close the clipboard
wx.TheClipboard.Close()
else:
# oops... something went wrong!
wx.MessageBox("Unable to open the clipboard", "Error")
See also
Call this function to add the data object to the clipboard. You may call this function repeatedly after having cleared the clipboard using Clear.
After this function has been called, the clipboard owns the data, so do not delete the data explicitly.
Parameters:
Returns:
bool
See also
Flushes the clipboard: this means that the data which is currently on clipboard will stay available even after the application exits (possibly eating memory), otherwise the clipboard will be emptied on exit.
Returns False if the operation is unsuccessful for any reason.
Returns:
bool
Returns global instance (wx.TheClipboard) of the object.
Returns:
Call this function to fill data with data on the clipboard, if available in the required format.
Returns True on success.
Parameters:
Returns:
bool
Returns True if the clipboard has been opened.
Returns:
bool
Returns True if there is data which matches the data format of the given data object currently available on the clipboard.
Parameters:
Returns:
bool
Call this function to open the clipboard before calling SetData and GetData.
Call Close when you have finished with the clipboard. You should keep the clipboard open for only a very short time.
Returns True on success. This should be tested (as in the sample shown above).
Returns:
bool
Call this function to set the data object to the clipboard. This function will clear all previous contents in the clipboard, so calling it several times does not make any sense.
After this function has been called, the clipboard owns the data, so do not delete the data explicitly.
Parameters:
Returns:
bool
See also
On platforms supporting it (currently only GTK), selects the so called PRIMARY SELECTION as the clipboard as opposed to the normal clipboard, if primary is True.
Parameters: