open_clipboard#

def open_clipboard() -> int

Opens clipboard. Must be called before any action in performed.

Returns:

int: 0 if function fails, 1 otherwise.

 

close_clipboard#

def close_clipboard() -> int

Closes clipboard. Must be called after all actions are performed.

Returns:

int: 0 if function fails, 1 otherwise.

 

empty_clipboard#

def empty_clipboard() -> int

Empties clipboard. Should be called before any setter actions.

Returns:

0 if function fails, 1 otherwise.

 

get_UNICODETEXT#

def get_UNICODETEXT() -> str

Gets text from clipboard as a string.

Returns:

str: text grabbed from clipboard.

 

set_UNICODETEXT#

def set_UNICODETEXT(text: str) -> bool

Sets text to clipboard in CF_UNICODETEXT format.

Arguments:

  • text (str): text to set to clipboard.

Returns:

bool: True if function succeeds.

 

get_FILEPATHS#

def get_FILEPATHS() -> list[str]

Gets list of filepaths from clipboard.

Returns:

list[str]: list of filepaths.

 

get_DIB#

def get_DIB(filepath: str = '', filename: str = 'bitmap') -> str

Gets image from clipboard as a bitmap and saves to filepath as filename.bmp.

Arguments:

  • filepath (str): filepath to save image into.
  • filename (str): filename of the image.

Returns:

str: full filepath of the saved image.

 

get_DIBV5#

def get_DIBV5(filepath: str = '', filename: str = 'bitmapV5') -> str

Gets image from clipboard as a bitmapV5 and saves to filepath as filename.bmp.

Arguments:

  • filepath (str): filepath to save image into.
  • filename (str): filename of the image.

Returns:

str: full filepath of the saved image.

 

get_PNG#

def get_PNG(filepath: str = '', filename: str = 'PNG') -> str

Gets image in PNG or image/png format from clipboard and saves to filepath as filename.png.

Arguments:

  • filepath (str): filepath to save image into.
  • filename (str): filename of the image.

Returns:

str: full filepath of the saved image.

 

set_DIB#

def set_DIB(src_bmp: str) -> bool

Sets given bitmap image to clipboard in CF_DIB or CF_DIBV5 format according to the image.

Arguments:

  • src_bmp (str): full filepath of source image.

Returns:

bool: True if function succeeds.

 

set_PNG#

def set_PNG(src_png: str) -> bool

Sets source PNG image to clipboard in PNG format.

Arguments:

  • src_png (str): full filepath of source image.

Returns:

bool: True if function succeeds.

 

is_format_available#

def is_format_available(format_id: int) -> bool

Checks whether specified format is currently available on the clipboard.

Arguments:

  • format_id (int): id of format to check for.

Returns:

bool: True if specified format is available, False otherwise.

 

get_available_formats#

def get_available_formats(buffer_size: int = 32) -> dict[int, str]

Gets a dict of all the currently available formats on the clipboard.

Arguments:

  • buffer_size (int): (optional) buffer size to store name of each format in.

Returns:

dict[int, str]: a dict {format_id : format_name} of all available formats.

 

get_image#

def get_image(filepath: str = '', filename: str = 'image') -> str

Gets image from clipboard in a format according to a priority list (PNG > DIBV5 > DIB).

Arguments:

  • filepath (str): filepath to save image into.
  • filename (str): filename of the image.

Returns:

str: full filepath of the saved image.

 

set_image#

def set_image(src_img: str) -> bool

(NOT FULLY IMPLEMENTED) Sets source image to clipboard in multiple formats (PNG, DIB).

Arguments:

  • src_img (str): full filepath of source image.

Returns:

bool: True if function succeeds.