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


Python Tk.selection_get方法代码示例

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


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

示例1: get

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import selection_get [as 别名]
	def get():
		r = Tk()
		r.withdraw()
		returnValue = r.selection_get(selection = "CLIPBOARD")
		r.destroy()

		return returnValue if returnValue else ''
开发者ID:klesun,项目名称:storyspace,代码行数:9,代码来源:Clipboard.py

示例2: get_PhoneAndEmail

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import selection_get [as 别名]
def get_PhoneAndEmail():
    r = Tk()
    r.withdraw()

    text = r.selection_get(selection = "CLIPBOARD")

    matches = []

    for groups in phoneRegex.findall(text):
        phoneNum = '-'.join([groups[1], groups[3], groups[5]])
        if groups[8] != '':
            phoneNum += ' x' + groups[8]
        matches.append(phoneNum)

    for groups in emailRegex.findall(text):
        matches.append(groups[0])

    if len(matches) > 0:
        r.clipboard_append('\n'.join(matches))
        print('Copied to clipboard:')
        print('\n'.join(matches))
        r.mainloop()
    else:
        print('No phone numbers or email addresses found.')
开发者ID:arunk38,项目名称:learn-to-code-in-python,代码行数:26,代码来源:6-PhoneAndEmail.py

示例3: Tk

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import selection_get [as 别名]
	if termLength == "one":
		return 1
	elif termLength == "two":
		return 2
	elif termLength == "three":
		return 3
	elif termLength == "four":
		return 4
	elif termLength == "five":
		return 5
	return 0

#get clipboard data
r = Tk()
r.withdraw()
result = r.selection_get(selection = "CLIPBOARD")
clipBoard = re.sub(r'[^\x00-\x7F]',"f",result)

#split and format
fullTermList = clipBoard.split("\n\n")
toClipboardStr = ""
for term in fullTermList:
	#remove commas for csv
	if len(term) > 1:
		length = lengthOfTerm(term) #Astronomy - the study of stars
		if length != 0:
			term = term.replace(",","")

			term = term.replace("\n"," ") #remove lines
			term = term.replace("-","") #remove lines joins
			term = term.replace("  "," ") #remove lines joins
开发者ID:danielrasmuson,项目名称:Course_Smart_Flashcards,代码行数:33,代码来源:fixFlashCards.py

示例4: open

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import selection_get [as 别名]
    pass


r = praw.Reddit(USERAGENT)

printfile = open(PRINTFILE, 'a+')
printfile.close()
#Hackjob method of creating file if it does not exist.

print('Permalink to thread\nLeave empty to paste from clipboard')
i = input('>')
pid = ''
if i == '':
    t = Tk()
    t.withdraw()
    link = t.selection_get(selection = "CLIPBOARD")
elif len(i) == 6:
    pid = i
    link = ''
else:
    link = i
if 'www.reddit.com/r/' in link and '/comments/' in link:
    pid = link.split('/comments/')[1].split('/')[0]
if 'http://redd.it/' in link:
    pid = link.split('redd.it/')[1]
print('\nThread ID: ' + pid)
print('Grabbing Thread')
try:
    post = r.get_info(thing_id='t3_' + pid)
    print('Pulling Root comments.')
    post.replace_more_comments(limit=None, threshold=0)
开发者ID:A-J-,项目名称:reddit,代码行数:33,代码来源:raffler.py

示例5: Tk

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import selection_get [as 别名]
import webbrowser
from tkinter import Tk

r = Tk()

r.withdraw()
address = r.selection_get(selection = "CLIPBOARD")
webbrowser.open("https://www.google.com/maps/place/" + address)
开发者ID:arunk38,项目名称:learn-to-code-in-python,代码行数:10,代码来源:9-mapit.py


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