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


Python clipboard.copy方法代码示例

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


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

示例1: printShortener

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def printShortener(shortener, url):
	#print "\n\tinside print."
	try:
		getshorted = shortener.short(url)
		print "\n\tShortened url is {}".format(getshorted)
		clipboard.copy(getshorted)
		print "\n\tDone, your shortened url is on clipboard.!"
		print "\n\tLaunch your browser and use 'Command-V' OR 'Ctrl + V' to paste the link in your browser."

		time.sleep(5)

		print "\n\tWant to Fetch QRCode? press 1 else press 0"

		choice=int(input("\n\t"))

		if choice == 1:
			getQRCode(shortener,url)
		elif choice == 0:
			return
		else:
			print "Error!"
			return

	except Exception as e:
		print str(e) 
开发者ID:avidLearnerInProgress,项目名称:python-automation-scripts,代码行数:27,代码来源:urlshortener.py

示例2: getQRCode

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def getQRCode(shortener, url):
	shortener.short(url)
	print "\n\tQRCode is on the URL: {}".format(shortener.qrcode())
	try:
		webbrowser.open_new_tab(shortener.qrcode())
		time.sleep(2)
	except Exception as e:	
		print "\n\tLaunch your browser and use 'Command-V' OR 'Ctrl + V' to paste the link in your browser."
		clipboard.copy(shortener.short(url))
		time.sleep(2)

#you could also save your qrcode locally by simply calling urllib on the image url



#----------------------- MAIN FUNCTIONS -------------------- 
开发者ID:avidLearnerInProgress,项目名称:python-automation-scripts,代码行数:18,代码来源:urlshortener.py

示例3: tinyurlShortener

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def tinyurlShortener(url):
	shortened = tinyurl.create_one(url)
	print "\n\tShortened url is {}".format(shortened)
	clipboard.copy(shortened)
	print "\n\tDone, your shortened url is on clipboard.!"
	print "\n\tLaunch your browser and use 'Command-V' OR 'Ctrl + V' to paste the link in your browser."
	time.sleep(5)
	print "\n\tWant to Fetch QRCode? press 1 else press 0"
	choice=int(input("\n\t"))
	if choice == 1:
		getOnlyQRCode(shortened)
	elif choice == 0:
		return
	else:
		print "Error!"
		return 
开发者ID:avidLearnerInProgress,项目名称:python-automation-scripts,代码行数:18,代码来源:urlshortener.py

示例4: isgdShortener

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def isgdShortener(tourl):
	url = 'https://is.gd/create.php?format=simple&url={}'.format(tourl)
	shortened = urllib2.urlopen(url).read()
	print "\n\tShortened url is {}".format(shortened)
	clipboard.copy(shortened)
	print "\n\tDone, your shortened url is on clipboard.!"
	print "\n\tLaunch your browser and use 'Command-V' OR 'Ctrl + V' to paste the link in your browser."
	time.sleep(5)
	print "\n\tWant to Fetch QRCode? press 1 else press 0"
	choice=int(input("\n\t"))
	if choice == 1:
		getOnlyQRCode(shortened)
	elif choice == 0:
		return
	else:
		print "Error!"
		return 
开发者ID:avidLearnerInProgress,项目名称:python-automation-scripts,代码行数:19,代码来源:urlshortener.py

示例5: _create_popup_menu

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def _create_popup_menu(self, widget=None):
        if widget is None: widget = self.widget
        menu = misc.wxGladePopupMenu(self.name)
        i = misc.append_menu_item(menu, -1, _('Remove Panel\tDel'),  wx.ART_DELETE)
        misc.bind_menu_item_after(widget, i, self.remove)
        i = misc.append_menu_item(menu, -1,   _('Copy\tCtrl+C'), wx.ART_COPY)
        misc.bind_menu_item_after(widget, i, clipboard.copy, self)
        i = misc.append_menu_item(menu, -1,    _('Cut\tCtrl+X'),  wx.ART_CUT)
        misc.bind_menu_item_after(widget, i, clipboard.cut, self)

        i = misc.append_menu_item(menu, -1, _('Paste Sizer\tCtrl+V'), wx.ART_PASTE)
        misc.bind_menu_item_after(widget, i, clipboard.paste, self)
        if self.children or not clipboard.check("sizer"): i.Enable(False)
        menu.AppendSeparator()

        if hasattr(self.parent, "_add_parent_popup_menu_items"):
            self.parent._add_parent_popup_menu_items(menu, self, widget)

        i = misc.append_menu_item(menu, -1, _('Preview'))
        misc.bind_menu_item_after(widget, i, self.preview_parent)

        return menu 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:24,代码来源:panel.py

示例6: colarAreaTransf

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def colarAreaTransf(string):
    clipboard.copy(string) 
开发者ID:HoussemCharf,项目名称:FunUtils,代码行数:4,代码来源:tradutor.py

示例7: copy_current_address

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def copy_current_address():
    start, end = sark.get_selection()
    clipboard.copy("0x{:08X}".format(start)) 
开发者ID:tmr232,项目名称:Sark,代码行数:5,代码来源:quick_copy.py

示例8: copy_current_file_offset

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def copy_current_file_offset():
    """Get the file-offset mapped to the current address."""
    start, end = sark.get_selection()

    try:
        file_offset = sark.core.get_fileregion_offset(start)
        clipboard.copy("0x{:08X}".format(file_offset))

    except sark.exceptions.NoFileOffset:
        message("The current address cannot be mapped to a valid offset of the input file.") 
开发者ID:tmr232,项目名称:Sark,代码行数:12,代码来源:quick_copy.py

示例9: copy_current_selection

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def copy_current_selection():
    start, end = sark.get_selection()
    buffer = sark.data.read_memory(start, end)
    clipboard.copy(to_hex_bytes(buffer)) 
开发者ID:tmr232,项目名称:Sark,代码行数:6,代码来源:quick_copy.py

示例10: get_bookmarklist

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def get_bookmarklist(bookId, headers):
    """获取某本书的笔记返回md文本"""
    url = "https://i.weread.qq.com/book/bookmarklist"
    params = dict(bookId=bookId)
    r = requests.get(url, params=params, headers=headers, verify=False)

    if r.ok:
        data = r.json()
        # clipboard.copy(json.dumps(data, indent=4, sort_keys=True))
    else:
        raise Exception(r.text)
    chapters = {c['chapterUid']: c['title'] for c in data['chapters']}
    contents = defaultdict(list)

    for item in sorted(data['updated'], key=lambda x: x['chapterUid']):
        # for item in data['updated']:
        chapter = item['chapterUid']
        text = item['markText']
        create_time = item["createTime"]
        start = int(item['range'].split('-')[0])
        contents[chapter].append((start, text))

    chapters_map = {title: level for level, title in get_chapters(int(bookId), headers)}
    res = ''
    for c in sorted(chapters.keys()):
        title = chapters[c]
        res += '#' * chapters_map[title] + ' ' + title + '\n'
        for start, text in sorted(contents[c], key=lambda e: e[0]):
            res += '> ' + text.strip() + '\n\n'
        res += '\n'

    return res 
开发者ID:shengqiangzhang,项目名称:examples-of-web-crawlers,代码行数:34,代码来源:wereader.py

示例11: get_bestbookmarks

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def get_bestbookmarks(bookId, headers):
    """获取书籍的热门划线,返回文本"""
    url = "https://i.weread.qq.com/book/bestbookmarks"
    params = dict(bookId=bookId)
    r = requests.get(url, params=params, headers=headers, verify=False)
    if r.ok:
        data = r.json()
        # clipboard.copy(json.dumps(data, indent=4, sort_keys=True))
    else:
        raise Exception(r.text)
    chapters = {c['chapterUid']: c['title'] for c in data['chapters']}
    contents = defaultdict(list)
    for item in data['items']:
        chapter = item['chapterUid']
        text = item['markText']
        contents[chapter].append(text)

    chapters_map = {title: level for level, title in get_chapters(int(bookId))}
    res = ''
    for c in chapters:
        title = chapters[c]
        res += '#' * chapters_map[title] + ' ' + title + '\n'
        for text in contents[c]:
            res += '> ' + text.strip() + '\n\n'
        res += '\n'
    return res 
开发者ID:shengqiangzhang,项目名称:examples-of-web-crawlers,代码行数:28,代码来源:wereader.py

示例12: get_chapters

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def get_chapters(bookId, headers):
    """获取书的目录"""
    url = "https://i.weread.qq.com/book/chapterInfos"
    data = '{"bookIds":["%d"],"synckeys":[0]}' % bookId

    r = requests.post(url, data=data, headers=headers, verify=False)

    if r.ok:
        data = r.json()
        clipboard.copy(json.dumps(data, indent=4, sort_keys=True))
    else:
        raise Exception(r.text)

    chapters = []
    for item in data['data'][0]['updated']:
        if 'anchors' in item:
            chapters.append((item.get('level', 1), item['title']))
            for ac in item['anchors']:
                chapters.append((ac['level'], ac['title']))

        elif 'level' in item:
            chapters.append((item.get('level', 1), item['title']))

        else:
            chapters.append((1, item['title']))

    return chapters 
开发者ID:shengqiangzhang,项目名称:examples-of-web-crawlers,代码行数:29,代码来源:wereader.py

示例13: ee_auth_entry

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def ee_auth_entry():
    auth_url = ee.oauth.get_authorization_url()
    clipboard.copy(auth_url)
    print("Authentication link copied: Go to browser and click paste")
    time.sleep(10)
    print("Enter your GEE API Token")
    password = str(getpass.getpass())
    auth_code = str(password)
    token = ee.oauth.request_token(auth_code)
    ee.oauth.write_token(token)
    print("\nSuccessfully saved authorization token.") 
开发者ID:samapriya,项目名称:Planet-GEE-Pipeline-CLI,代码行数:13,代码来源:ppipe.py

示例14: main

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def main():

	print "\n\tList of URL Shortener Services:\n\t\t1. Google\n\t\t2. Bit.ly\n\t\t3. TinyURL\n\t\t4. IS.GD\n\t\t"
	try:
		choice = int(raw_input("\n\tChoose URL SHORTENER service: "))
		print "\n\tTo enter url, you can type manually in your console or else you can copy the url using 'Command-V' or 'Ctrl + V'\n\tfrom browser."
		print "\n\t1. Manually in console\n\t2. Copy from browser\t"
		urlchoice = int(raw_input("\n\tEnter choice: "))

		if urlchoice == 1:
			print "\n\tEnter url to be shortened: ",

			url = str(raw_input(""))
		elif urlchoice == 2:
			print "\tYou have five seconds..copy the url from address bar you wish to shorten!"
			time.sleep(5)
			url = clipboard.paste()
		else:
			print "\n\tInvalid Option.! Quitting.."
			time.sleep(1)
			sys.exit(0)

		if choice == 1:
			googleShortener(url)

		elif choice == 2:
			bitlyShortener(url)

		elif choice == 3:
			tinyurlShortener(url)

		elif choice == 4:
			isgdShortener(url)

		else:
			print "Invalid Service."

	except Exception as e:
		print str(e) 
开发者ID:avidLearnerInProgress,项目名称:python-automation-scripts,代码行数:41,代码来源:urlshortener.py

示例15: gcs_cred

# 需要导入模块: import clipboard [as 别名]
# 或者: from clipboard import copy [as 别名]
def gcs_cred(cred):
    with open (cred) as file:
        aoi_resp=json.load(file)
        filestr=json.dumps(aoi_resp)
        print('')
        bstr = filestr.encode('utf-8')
        try:
            clipboard.copy(base64.b64encode(bstr).decode('ascii'))
            print('base64 encoding copied to clipboard')
        except Exception as e:
            print('Unable to copy to clipboard'+'\n')
            print(base64.b64encode(bstr).decode('ascii')) 
开发者ID:tyson-swetnam,项目名称:porder,代码行数:14,代码来源:porder.py


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