当前位置: 首页>>代码示例>>Python>>正文


Python pyperclip.paste方法代码示例

本文整理汇总了Python中pyperclip.paste方法的典型用法代码示例。如果您正苦于以下问题:Python pyperclip.paste方法的具体用法?Python pyperclip.paste怎么用?Python pyperclip.paste使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyperclip的用法示例。


在下文中一共展示了pyperclip.paste方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: lazy_load_stub_copy

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def lazy_load_stub_copy(text):
    '''
    A stub function for copy(), which will load the real copy() function when
    called so that the real copy() function is used for later calls.

    This allows users to import pyperclip without having determine_clipboard()
    automatically run, which will automatically select a clipboard mechanism.
    This could be a problem if it selects, say, the memory-heavy PyQt4 module
    but the user was just going to immediately call set_clipboard() to use a
    different clipboard mechanism.

    The lazy loading this stub function implements gives the user a chance to
    call set_clipboard() to pick another clipboard mechanism. Or, if the user
    simply calls copy() or paste() without calling set_clipboard() first,
    will fall back on whatever clipboard mechanism that determine_clipboard()
    automatically chooses.
    '''
    global copy, paste
    copy, paste = determine_clipboard()
    return copy(text) 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:22,代码来源:__init__.py

示例2: lazy_load_stub_paste

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def lazy_load_stub_paste():
    '''
    A stub function for paste(), which will load the real paste() function when
    called so that the real paste() function is used for later calls.

    This allows users to import pyperclip without having determine_clipboard()
    automatically run, which will automatically select a clipboard mechanism.
    This could be a problem if it selects, say, the memory-heavy PyQt4 module
    but the user was just going to immediately call set_clipboard() to use a
    different clipboard mechanism.

    The lazy loading this stub function implements gives the user a chance to
    call set_clipboard() to pick another clipboard mechanism. Or, if the user
    simply calls copy() or paste() without calling set_clipboard() first,
    will fall back on whatever clipboard mechanism that determine_clipboard()
    automatically chooses.
    '''
    global copy, paste
    copy, paste = determine_clipboard()
    return paste() 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:22,代码来源:__init__.py

示例3: pil_grid

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def pil_grid(images, max_horiz=np.iinfo(int).max):
    """
    Generates one image out of many blobs.
    """
    n_images = len(images)
    n_horiz = min(n_images, max_horiz)
    h_sizes, v_sizes = [0] * n_horiz, [0] * (n_images // n_horiz)
    for i, im in enumerate(images):
        h, v = i % n_horiz, i // n_horiz
        h_sizes[h] = max(h_sizes[h], im.size[0])
        v_sizes[v] = max(v_sizes[v], im.size[1])
    h_sizes, v_sizes = np.cumsum([0] + h_sizes), np.cumsum([0] + v_sizes)
    im_grid = Image.new('RGB', (h_sizes[-1], v_sizes[-1]), color='white')
    for i, im in enumerate(images):
        im_grid.paste(im, (h_sizes[i % n_horiz], v_sizes[i // n_horiz]))
    return im_grid 
开发者ID:Boquete,项目名称:google-arts-crawler,代码行数:18,代码来源:crawler.py

示例4: paste

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def paste(self, *args):
        """ Usage: paste([PSMRL], text)

        If a pattern is specified, the pattern is clicked first. Doesn't support text paths.
        ``text`` is pasted as is using the OS paste shortcut (Ctrl+V for Windows/Linux, Cmd+V
        for OS X). Note that `paste()` does NOT use special formatting like `type()`.
        """
        target = None
        text = ""
        if len(args) == 1 and isinstance(args[0], basestring):
            text = args[0]
        elif len(args) == 2 and isinstance(args[1], basestring):
            self.click(target)
            text = args[1]
        else:
            raise TypeError("paste method expected [PSMRL], text")

        pyperclip.copy(text)
        # Triggers OS paste for foreground window
        PlatformManager.osPaste()
        time.sleep(0.2) 
开发者ID:glitchassassin,项目名称:lackey,代码行数:23,代码来源:RegionMatching.py

示例5: _get_source_code

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def _get_source_code(code, code_file):
    if code is not None:
        code_str = code
    elif code_file is not None:
        with open(code_file) as fi:
            code_str = fi.read()
    else:
        try:
            code_str = pyperclip.paste()
        except pyperclip.PyperclipException:
            raise Exception(
                'Could not retrieve code from the clipboard. '
                'Try putting your code in a file and using '
                'the `code_file` parameter instead of using the clipboard.'
            )
    return code_str


# an "input chunk" includes all lines (including comments/empty lines) that
# come after the preceding python statement and before the python statement in
# this chunk. each chunk will be placed in a notebook cell. 
开发者ID:crew102,项目名称:reprexpy,代码行数:23,代码来源:reprex.py

示例6: get_data

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def get_data(self) -> ClipboardData:
        text = pyperclip.paste()

        # When the clipboard data is equal to what we copied last time, reuse
        # the `ClipboardData` instance. That way we're sure to keep the same
        # `SelectionType`.
        if self._data and self._data.text == text:
            return self._data

        # Pyperclip returned something else. Create a new `ClipboardData`
        # instance.
        else:
            return ClipboardData(
                text=text,
                type=SelectionType.LINES if "\n" in text else SelectionType.LINES,
            ) 
开发者ID:prompt-toolkit,项目名称:python-prompt-toolkit,代码行数:18,代码来源:pyperclip.py

示例7: on_key_press

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def on_key_press(self, symbol, modifiers):
        self.make_active()
        self.style()
        self.problem = False
        self.need_update = True
        key = pyglet.window.key

        if symbol == key.TAB:
            self.document.insert_text(self.caret.position, '    ')
            self.caret.position += 4

        elif modifiers & key.MOD_CTRL:
            if symbol == key.C:
                start = min(self.caret.position, self.caret.mark)
                end = max(self.caret.position, self.caret.mark)
                text = self.document.text[start:end]
                pyperclip.copy(text)
            elif symbol == key.V:
                text = pyperclip.paste()
                self.document.insert_text(self.caret.position, text)
                self.caret.position += len(text) 
开发者ID:honix,项目名称:Pyno,代码行数:23,代码来源:field.py

示例8: definitions

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def definitions():
    """ Converts Mindustry attribute decelleration 
    into a Markdown table. """
    import parser
    import pyperclip
    i = pyperclip.paste()
    o = parser.build_definition_table(i)
    pyperclip.copy(o)
    click.echo(oe) 
开发者ID:SimonWoodburyForget,项目名称:mindustry-modding,代码行数:11,代码来源:__main__.py

示例9: defaults

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def defaults():
    """ Converts Mindustry attribute decelleration 
    into a Markdown table. """
    import parser
    import pyperclip
    i = pyperclip.paste()
    o = parser.build_defaults_table(i)
    pyperclip.copy(o)
    click.echo(o) 
开发者ID:SimonWoodburyForget,项目名称:mindustry-modding,代码行数:11,代码来源:__main__.py

示例10: set_clipboard

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def set_clipboard(clipboard):
    '''
    Explicitly sets the clipboard mechanism. The "clipboard mechanism" is how
    the copy() and paste() functions interact with the operating system to
    implement the copy/paste feature. The clipboard parameter must be one of:
        - pbcopy
        - pbobjc (default on Mac OS X)
        - gtk
        - qt
        - xclip
        - xsel
        - klipper
        - windows (default on Windows)
        - no (this is what is set when no clipboard mechanism can be found)
    '''
    global copy, paste

    clipboard_types = {'pbcopy': init_osx_pbcopy_clipboard,
                       'pyobjc': init_osx_pyobjc_clipboard,
                       'gtk': init_gtk_clipboard,
                       'qt': init_qt_clipboard, # TODO - split this into 'qtpy', 'pyqt4', and 'pyqt5'
                       'xclip': init_xclip_clipboard,
                       'xsel': init_xsel_clipboard,
                       'klipper': init_klipper_clipboard,
                       'windows': init_windows_clipboard,
                       'no': init_no_clipboard}

    if clipboard not in clipboard_types:
        raise ValueError('Argument must be one of %s' % (', '.join([repr(_) for _ in clipboard_types.keys()])))

    # Sets pyperclip's copy() and paste() functions:
    copy, paste = clipboard_types[clipboard]() 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:34,代码来源:__init__.py

示例11: is_available

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def is_available():
    return copy != lazy_load_stub_copy and paste != lazy_load_stub_paste


# Initially, copy() and paste() are set to lazy loading wrappers which will
# set `copy` and `paste` to real functions the first time they're used, unless
# set_clipboard() or determine_clipboard() is called first. 
开发者ID:danielecook,项目名称:gist-alfred,代码行数:9,代码来源:__init__.py

示例12: is_changed

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def is_changed():
    """
        Returns `True` if the clipboard content has changed
    """

    return clipboard_signature != get_signature(pyperclip.paste()) 
开发者ID:gabfl,项目名称:vault,代码行数:8,代码来源:clipboard.py

示例13: set_clipboard

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def set_clipboard(clipboard):
    global copy, paste

    clipboard_types = {'osx': init_osx_clipboard,
                       'gtk': init_gtk_clipboard,
                       'qt': init_qt_clipboard,
                       'xclip': init_xclip_clipboard,
                       'xsel': init_xsel_clipboard,
                       'klipper': init_klipper_clipboard,
                       'windows': init_windows_clipboard,
                       'no': init_no_clipboard}

    copy, paste = clipboard_types[clipboard]() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:15,代码来源:__init__.py

示例14: main

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def main(url, size, raise_errors):
    try:
        cleanup()
        url = pyperclip.paste()
        if not DEFAULT_HOST in url:
            url, size = get_user_input()
        print("> Opening website")
        generate_image(url, size, raise_errors)
        cleanup()
    except Exception as e:
        print("FAILED")
        if raise_errors:
            raise e
        print(e) 
开发者ID:Boquete,项目名称:google-arts-crawler,代码行数:16,代码来源:crawler.py

示例15: getClipboard

# 需要导入模块: import pyperclip [as 别名]
# 或者: from pyperclip import paste [as 别名]
def getClipboard(cls):
        """ Gets the contents of the clipboard (as classmethod) """
        return pyperclip.paste() 
开发者ID:glitchassassin,项目名称:lackey,代码行数:5,代码来源:App.py


注:本文中的pyperclip.paste方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。