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


Python win32clipboard.EmptyClipboard方法代码示例

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


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

示例1: copy_to_system

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def copy_to_system(self, clear=True):
        """
            Copy the contents of this instance into the Windows system
            clipboard.

            Arguments:
             - *clear* (boolean, default: True) -- if true, the Windows
               system clipboard will be cleared before this instance's
               contents are transferred.

        """
        win32clipboard.OpenClipboard()
        try:
            # Clear the system clipboard, if requested.
            if clear:
                win32clipboard.EmptyClipboard()

            # Transfer content to Windows system clipboard.
            for format, content in self._contents.items():
                win32clipboard.SetClipboardData(format, content)

        finally:
            win32clipboard.CloseClipboard() 
开发者ID:dictation-toolbox,项目名称:dragonfly,代码行数:25,代码来源:clipboard.py

示例2: stop_line_profiler

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def stop_line_profiler():
    """Stops the line profiler and prints the results"""
    global _active_line_profiler
    if not _active_line_profiler:
        return

    stream = StringIO()
    _active_line_profiler.print_stats(stream=stream)
    _active_line_profiler = None

    # print the results to the log
    print(stream.getvalue())

    # and copy to the clipboard
    win32clipboard.OpenClipboard()
    win32clipboard.EmptyClipboard()
    win32clipboard.SetClipboardText(stream.getvalue())
    win32clipboard.CloseClipboard()

    xlcAlert("Line Profiler Stopped\n"
             "Results have been written to the log and clipboard.") 
开发者ID:pyxll,项目名称:pyxll-examples,代码行数:23,代码来源:profiling_tools.py

示例3: put

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def put(data):
    if sys.platform == "win32":
        import win32clipboard as clip
        clip.OpenClipboard()
        clip.EmptyClipboard()
        clip.SetClipboardText(data, clip.CF_UNICODETEXT)
        clip.CloseClipboard()
    elif sys.platform.startswith("linux"):
        import subprocess
        proc = subprocess.Popen(("xsel", "-i", "-b", "-l", "/dev/null"),
                                stdin=subprocess.PIPE)
        proc.stdin.write(data.encode("utf-8"))
        proc.stdin.close()
        proc.wait()
    else:
        raise RuntimeError("Unsupported platform") 
开发者ID:grawity,项目名称:code,代码行数:18,代码来源:clipboard.py

示例4: write_to_paste_buffer

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def write_to_paste_buffer(txt):
            win32clipboard.OpenClipboard(0)
            win32clipboard.EmptyClipboard()
            win32clipboard.SetClipboardText(txt)
            win32clipboard.CloseClipboard() 
开发者ID:OpenTrading,项目名称:OpenTrader,代码行数:7,代码来源:cmd2plus.py

示例5: set_system_text

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def set_system_text(cls, content):
        content = text_type(content)
        win32clipboard.OpenClipboard()
        try:
            win32clipboard.EmptyClipboard()
            win32clipboard.SetClipboardData(cls.format_unicode, content)
        finally:
            win32clipboard.CloseClipboard() 
开发者ID:dictation-toolbox,项目名称:dragonfly,代码行数:10,代码来源:clipboard.py

示例6: clear_clipboard

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def clear_clipboard(cls):
        win32clipboard.OpenClipboard()
        try:
            win32clipboard.EmptyClipboard()
        finally:
            win32clipboard.CloseClipboard()

    #----------------------------------------------------------------------- 
开发者ID:dictation-toolbox,项目名称:dragonfly,代码行数:10,代码来源:clipboard.py

示例7: clear

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def clear( self ):
		"""
			\remarks	Deletes the content of the clipboard.
			\return		<bool> success
		"""
		import win32clipboard
		win32clipboard.OpenClipboard()
		win32clipboard.EmptyClipboard()
		win32clipboard.CloseClipboard()
		return True 
开发者ID:blurstudio,项目名称:cross3d,代码行数:12,代码来源:clipboard.py

示例8: clipboardCopyText

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def clipboardCopyText(self, text):
		""" Set the provided text to the system clipboard so it can be pasted
		
		This function is used because QApplication.clipboard sometimes deadlocks in some
		applications like XSI.
		
		Args:
			text (str): Set the text in the paste buffer to this text.
		"""
		import win32clipboard
		win32clipboard.OpenClipboard()
		win32clipboard.EmptyClipboard()
		win32clipboard.SetClipboardText(text)
		win32clipboard.CloseClipboard() 
开发者ID:blurstudio,项目名称:cross3d,代码行数:16,代码来源:softimageapplication.py

示例9: set_system_text

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def set_system_text(cls, content):
        content = unicode(content)
        win32clipboard.OpenClipboard()
        try:
            win32clipboard.EmptyClipboard()
            win32clipboard.SetClipboardData(cls.format_unicode, content)
        finally:
            win32clipboard.CloseClipboard()


    #----------------------------------------------------------------------- 
开发者ID:t4ngo,项目名称:dragonfly,代码行数:13,代码来源:clipboard.py

示例10: setClipboardData

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def setClipboardData(data): # “ Václav
        win32clipboard.EmptyClipboard()
        win32clipboard.SetClipboardData(win32clipboard.CF_UNICODETEXT,
            data) 
开发者ID:ActiveState,项目名称:code,代码行数:6,代码来源:recipe-576887.py

示例11: stop_profiling

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def stop_profiling():
    """Stop the cProfile profiler and print the results"""
    global _active_cprofiler
    if not _active_cprofiler:
        xlcAlert("No active profiler")
        return

    _active_cprofiler.disable()

    # print the profiler stats
    stream = StringIO()
    stats = pstats.Stats(_active_cprofiler, stream=stream).sort_stats("cumulative")
    stats.print_stats()

    # print the results to the log
    print(stream.getvalue())

    # and copy to the clipboard
    win32clipboard.OpenClipboard()
    win32clipboard.EmptyClipboard()
    win32clipboard.SetClipboardText(stream.getvalue())
    win32clipboard.CloseClipboard()

    _active_cprofiler = None

    xlcAlert("cProfiler Stopped\n"
             "Results have been written to the log and clipboard.")


# Current active line profiler 
开发者ID:pyxll,项目名称:pyxll-examples,代码行数:32,代码来源:profiling_tools.py

示例12: main

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def main(host=None, port=None, serial=None, scale=1.0, out='screenshot.png', method='minicap'):
    """
    If minicap not avaliable then use uiautomator instead

    Disable scale for now.
    Because -s scale is conflict of -s serial
    """
    print('Started screencap')
    start = time.time()

    client = adbkit.Client(host=host, port=port)
    device = client.device(serial)
    im = device.screenshot(scale=scale)
    im.save(out)
    print('Time spend: %.2fs' % (time.time() - start))
    print('File saved to "%s"' % out)

    try:
        import win32clipboard

        output = StringIO()
        im.convert("RGB").save(output, "BMP")
        data = output.getvalue()[14:]
        output.close()

        win32clipboard.OpenClipboard()
        win32clipboard.EmptyClipboard()
        win32clipboard.SetClipboardData(win32clipboard.CF_DIB, data)
        win32clipboard.CloseClipboard()
        print('Copied to clipboard')
    except:
        pass # ignore 
开发者ID:NetEaseGame,项目名称:ATX,代码行数:34,代码来源:screencap.py

示例13: recv

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def recv(self, data):
            try:
                text = data.decode(self.session.server.codec)
                win32clipboard.OpenClipboard(self.session.app.hwnd)
                win32clipboard.EmptyClipboard()
                win32clipboard.SetClipboardText(text)
                win32clipboard.CloseClipboard()
            except UnicodeError:
                self.error('encoding error')
            except pywintypes.error as e:
                self.error('error: %r' % e)
            return 
开发者ID:euske,项目名称:pyrexecd,代码行数:14,代码来源:__init__.py

示例14: copy_from_system

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def copy_from_system(self, formats=None, clear=False):
        """
            Copy the Windows system clipboard contents into this instance.

            Arguments:
             - *formats* (iterable, default: None) -- if not None, only the
               given content formats will be retrieved.  If None, all
               available formats will be retrieved.
             - *clear* (boolean, default: False) -- if true, the Windows
               system clipboard will be cleared after its contents have been
               retrieved.

        """
        win32clipboard.OpenClipboard()
        try:
            # Determine which formats to retrieve.
            if not formats:
                format = 0
                formats = []
                while 1:
                    format = win32clipboard.EnumClipboardFormats(format)
                    if not format:
                        break
                    formats.append(format)
            elif isinstance(formats, integer_types):
                formats = (formats,)

            # Verify that the given formats are valid.
            for format in formats:
                if not isinstance(format, integer_types):
                    raise TypeError("Invalid clipboard format: %r"
                                    % format)

            # Retrieve Windows system clipboard content.
            contents = {}
            for format in formats:
                content = win32clipboard.GetClipboardData(format)
                contents[format] = content
            self._contents = contents

            # Clear the system clipboard, if requested, and close it.
            if clear:
                win32clipboard.EmptyClipboard()

        finally:
            win32clipboard.CloseClipboard() 
开发者ID:dictation-toolbox,项目名称:dragonfly,代码行数:48,代码来源:clipboard.py

示例15: copy_from_system

# 需要导入模块: import win32clipboard [as 别名]
# 或者: from win32clipboard import EmptyClipboard [as 别名]
def copy_from_system(self, formats=None, clear=False):
        """
            Copy the Windows system clipboard contents into this instance.

            Arguments:
             - *formats* (iterable, default: None) -- if not None, only the
               given content formats will be retrieved.  If None, all
               available formats will be retrieved.
             - *clear* (boolean, default: False) -- if true, the Windows
               system clipboard will be cleared after its contents have been
               retrieved.

        """
        win32clipboard.OpenClipboard()
        try:
            # Determine which formats to retrieve.
            if not formats:
                format = 0
                formats = []
                while 1:
                    format = win32clipboard.EnumClipboardFormats(format)
                    if not format:
                        break
                    formats.append(format)
            elif isinstance(formats, int):
                formats = (formats,)

            # Verify that the given formats are valid.
            try:
                for format in formats:
                    if not isinstance(format, int):
                        raise TypeError("Invalid clipboard format: %r"
                                        % format)
            except Exception, e:
                raise

            # Retrieve Windows system clipboard content.
            contents = {}
            for format in formats:
                content = win32clipboard.GetClipboardData(format)
                contents[format] = content
            self._contents = contents

            # Clear the system clipboard, if requested, and close it.
            if clear:
                win32clipboard.EmptyClipboard() 
开发者ID:t4ngo,项目名称:dragonfly,代码行数:48,代码来源:clipboard.py


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