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


Python Tk.clipboard_get方法代码示例

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


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

示例1: tkinter_clipboard_get

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
def tkinter_clipboard_get():
    """ 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.
    """
    try:
        from tkinter import Tk, TclError  # Py 3
    except ImportError:
        try:
            from Tkinter import Tk, TclError  # Py 2
        except ImportError:
            raise TryNext("Getting text from the clipboard on this platform "
                          "requires Tkinter.")
    root = Tk()
    root.withdraw()
    try:
        text = root.clipboard_get()
    except TclError:
        raise ClipboardEmpty
    finally:
        root.destroy()
    text = py3compat.cast_unicode(text, py3compat.DEFAULT_ENCODING)
    return text
开发者ID:mattvonrocketstein,项目名称:smash,代码行数:27,代码来源:clipboard.py

示例2: getClipBoardText

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
def getClipBoardText():
	from tkinter import Tk

	r = Tk()
	# read the clipboard
	c = r.clipboard_get()
	return c
开发者ID:ll2585,项目名称:reader,代码行数:9,代码来源:utilities.py

示例3: paste

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
def paste():
    """paste text from clipboad"""
    try:
        root=Tk()
        root.withdraw()
        return root.clipboard_get()
    except Exception as e:
        print ('Error: ',e)
    finally:
        root.destroy()
开发者ID:adyezik,项目名称:Xclipboard,代码行数:12,代码来源:Xclipboard.py

示例4: main

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
def main():
	t=Tk()
	t.withdraw()
	text=t.clipboard_get()
	#text="_example=2345..."
	r=re.compile("(_[A-z]+(?==))")
	m=list(set(r.findall(text)))
	m=str(m).translate(str.maketrans("'",'"'))
	print(m)
	t.clipboard_clear()
	t.clipboard_append(m)
	t.destroy()
开发者ID:crapola,项目名称:arma3Dto2D,代码行数:14,代码来源:arma_sqf_autoprivate.py

示例5: g

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
 def g():
     r = Tk()
     r.withdraw()
     data = r.clipboard_get()
     r.destroy()
     return data
开发者ID:instantshare,项目名称:instantshare,代码行数:8,代码来源:clipboard.py

示例6: print

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
    scenario_list_full.append(scenario_line_full)

scenario_list_full.sort()
# scenario_list_full.reverse()

print(scenario_list_full)
# print(scenario_count_dict)

# ========================输入区开始========================
dict_file_path = '/Users/alicewish/我的坚果云/userdict.txt'  # 自定义词典路径

# ================读取剪贴板================
from tkinter import Tk

r = Tk()
read_text = r.clipboard_get()
text_readline = read_text.splitlines()
# print(text_readline)

# ================按行读取文本:with open(更好)================
status_readline = []  # 状态列表
cut_readline = []  # 分词列表
output_readline = []  # 输出列表

jieba.load_userdict(dict_file_path)

for i in range(len(text_readline)):
    line = text_readline[i]
    line = line.replace('……', '…')
    print(line)
    print(len(line))
开发者ID:alicewish,项目名称:Python-Learning,代码行数:33,代码来源:文本处理-训练并断行.py

示例7: Tk

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
from lxml import html
import requests, time

start_time = time.time()  # 初始时间戳

# ================读取剪贴板================
from tkinter import Tk
r = Tk()
c = r.clipboard_get()
print(c)
print(type(c))

# ================运行时间计时================
run_time = time.time() - start_time
if run_time < 60:  # 两位小数的秒
    print("耗时:{:.2f}秒".format(run_time))
elif run_time < 3600:  # 分秒取整
    print("耗时:{:.0f}分{:.0f}秒".format(run_time // 60, run_time % 60))
else:  # 时分秒取整
    print("耗时:{:.0f}时{:.0f}分{:.0f}秒".format(run_time // 3600, run_time % 3600 // 60, run_time % 60))
开发者ID:BewareMyPower,项目名称:Python-Learning,代码行数:22,代码来源:文本处理-读取剪贴板.py

示例8: Tk

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
import re
# ================读取剪贴板================
from tkinter import Tk
r = Tk()
clipboard_content = r.clipboard_get()

replaced = re.sub('<span id=".*" class="anchor"></span>', 'a', clipboard_content)
print(replaced)
开发者ID:alicewish,项目名称:Python-Learning,代码行数:10,代码来源:文本处理-正则替换.py

示例9: ReadClipL

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
def ReadClipL():
    from tkinter import Tk
    r = Tk()
    read_text = r.clipboard_get()
    text_readline = read_text.splitlines()
    return text_readline
开发者ID:alicewish,项目名称:Python-Learning,代码行数:8,代码来源:MyDef.py

示例10: ReadClip

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import clipboard_get [as 别名]
def ReadClip():
    from tkinter import Tk
    r = Tk()
    read_text = r.clipboard_get()
    return read_text
开发者ID:alicewish,项目名称:Python-Learning,代码行数:7,代码来源:MyDef.py


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