本文整理匯總了Python中clipboard.paste方法的典型用法代碼示例。如果您正苦於以下問題:Python clipboard.paste方法的具體用法?Python clipboard.paste怎麽用?Python clipboard.paste使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類clipboard
的用法示例。
在下文中一共展示了clipboard.paste方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: getQRCode
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [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 --------------------
示例2: printShortener
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [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)
示例3: tinyurlShortener
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [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
示例4: isgdShortener
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [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
示例5: areaTransferencia
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [as 別名]
def areaTransferencia():
string = clipboard.paste()
return string
示例6: listener
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [as 別名]
def listener(string):
while clipboard.paste() == string:
time.sleep(1)
示例7: main
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [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)
示例8: duplicate
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [as 別名]
def duplicate(self, *args):
clipboard.copy(self)
clipboard.paste(common.root)
示例9: _create_popup_menu
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [as 別名]
def _create_popup_menu(self, widget):
# remove, hide
menu = misc.wxGladePopupMenu(self.name)
widgetclass = self.__class__.__name__.lstrip("Edit")
if self.widget and self.is_visible():
# hide window
i = misc.append_menu_item(menu, -1, _('Hide Design Window'))
misc.bind_menu_item_after(widget, i, self.hide_widget)
else:
i = misc.append_menu_item(menu, -1, _('Show Design Window'))
misc.bind_menu_item_after(widget, i, common.app_tree.show_toplevel, None, self)
menu.AppendSeparator()
i = misc.append_menu_item(menu, -1, _('Remove %s\tDel')%widgetclass, wx.ART_DELETE)
misc.bind_menu_item_after(widget, i, self.remove)
i = misc.append_menu_item(menu, -1, _('Duplicate %s')%widgetclass, wx.ART_COPY)
misc.bind_menu_item_after(widget, i, self.duplicate)
# paste
i = misc.append_menu_item(menu, -1, _('Paste Sizer\tCtrl+V'), wx.ART_PASTE)
misc.bind_menu_item_after(widget, i, clipboard.paste, self)
# XXX change later on to allow other widgets to be pasted
if self.children or not clipboard.check("sizer"): i.Enable(False)
# preview
menu.AppendSeparator()
i = misc.append_menu_item(menu, -1, _('Preview %s\tF5'%widgetclass))
misc.bind_menu_item(widget, i, self.preview_parent)
return menu
示例10: on_select_and_paste
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [as 別名]
def on_select_and_paste(self, *args):
"Middle-click event handler: selects the slot and, if the clipboard is not empty, pastes its content here"
misc.focused_widget = self
self.widget.SetFocus()
clipboard.paste(self)
####################################################################################################################
示例11: _paste
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [as 別名]
def _paste():
if focused_widget is None: return
if not hasattr(focused_widget, "clipboard_paste"):
wx.Bell()
return
clipboard.paste(focused_widget)
示例12: navigate
# 需要導入模塊: import clipboard [as 別名]
# 或者: from clipboard import paste [as 別名]
def navigate(up):
# move up or down in tree
focus = focused_widget
if not focus:
# get from Tree widget
item = common.app_tree.GetFocusedItem()
focus = common.app_tree._GetItemData(item)
if focus is None: return
siblings = [focus] if focus.IS_ROOT else focus.parent.get_all_children()
if not siblings: return
idx = siblings.index(focus)
if up:
if idx>0:
focus = siblings[idx-1]
children = focus.get_all_children()
if children: focus = children[-1]
else:
# no upper sibling -> go up
focus = focus.parent
else:
# down: look for children
children = focus.get_all_children()
if children:
# go to first child
focus = children[0]
else:
if idx+1<len(siblings):
# go to next sibling
focus = siblings[idx+1]
else:
# go up one or more levels
while True:
if not focus.parent: return
siblings = focus.parent.get_all_children()
if siblings:
idx = siblings.index(focus)
if idx+1<len(siblings):
focus = siblings[idx+1]
break
focus = focus.parent
if focus: set_focused_widget(focus)
# accelerator tables to enable keyboard shortcuts for the popup menus of the various widgets (remove, cut, copy, paste)
# only for the editing windows: