clipboard module

Autogenerated docs for the clipboard

Let’s re-implement it as an abstract factory.

exception ClipboardEmpty[source][source]

Bases: ValueError

class WindowsClipboard(_clipboard=None, *args, **kwargs)[source][source]

Bases: prompt_toolkit.clipboard.base.Clipboard

Creates a prompt_toolkit compatible implementation of a _clipboard.

Notes

Requires Mark Hammond’s pywin32 extensions.

__init__(_clipboard=None, *args, **kwargs)[source][source]

Open a _clipboard on windows with win32clipboard.OpenClipboard.

Raises

TryNext – If win32clipboard can’t be imported.

win_clip_pywin32()[source][source]

Utilize pywin32 to get the user’s text.

Returns

Return type

win32_clipboard_get()[source][source]

Get the current _clipboard’s text on Windows.

Runs win_clip_pywin32() and if there’s any exception attempts to run win32yank through a piped subprocess.

Returns

Return type

Text as returned by win32clipboard.GetClipboardData or None.

rotate()[source][source]
get_text()[source][source]
tkinter_clipboard_get()[source][source]

Get the _clipboard’s text using Tkinter.

This is the default on systems that are not Windows or OS X. It may interfere with other UI toolkits and should be replaced with an implementation that uses that toolkit.

Notes

Requires tkinter.

Raises

ClipboardEmpty

class ClipboardMagics(**kwargs)[source][source]

Bases: IPython.core.magic.Magics

Haven’t seen it implemented in a different way than this.

__init__(shell=None, *args, **kwargs)[source][source]

Bind the IPython instance and it’s config and parent attributes.

load_ipython_extension()[source][source]

Sep 20, 2019: Works!

termux_clipboard_get()[source][source]
pyperclip_magic()[source][source]
magics = {'cell': {}, 'line': {'pyperclip_magic': 'pyperclip_magic', 'termux_clipboard_get': 'termux_clipboard_get'}}[source]
registered = True[source]
class UsefulClipboard(clipboard=None)[source][source]

Bases: prompt_toolkit.clipboard.base.Clipboard

Clipboard class that can dynamically returns any Clipboard.

Uses more functionally applicable defaults and requires less boilerplate.

__init__(clipboard=None)[source][source]
load()[source][source]

TODO: This actually isn’t gonna work.

We need to implement each individual function above as a class that meets the required API for a Clipboard class aka has methods set_data, set_text, rotate, and get_data.

In addition it must be callable. Jesus.

set_data(data)[source][source]
set_text(text)[source][source]
rotate()[source][source]
get_data() → prompt_toolkit.clipboard.base.ClipboardData[source][source]
get_text() → AnyStr[source][source]

Return the text on the _clipboard.

termux_clipboard_get()[source][source]
pyperclip()[source][source]
setup_clipboard()[source][source]
Return type

object