Python clipboard.paste() Examples

The following are 12 code examples of clipboard.paste(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module clipboard , or try the search function .
Example #1
Source File: urlshortener.py    From python-automation-scripts with GNU General Public License v3.0 6 votes vote down vote up
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) 
Example #2
Source File: urlshortener.py    From python-automation-scripts with GNU General Public License v3.0 6 votes vote down vote up
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 -------------------- 
Example #3
Source File: urlshortener.py    From python-automation-scripts with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #4
Source File: urlshortener.py    From python-automation-scripts with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #5
Source File: tradutor.py    From FunUtils with MIT License 5 votes vote down vote up
def areaTransferencia():
    string = clipboard.paste()
    return string 
Example #6
Source File: tradutor.py    From FunUtils with MIT License 5 votes vote down vote up
def listener(string):
    while clipboard.paste() == string:
        time.sleep(1) 
Example #7
Source File: urlshortener.py    From python-automation-scripts with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #8
Source File: edit_windows.py    From wxGlade with MIT License 5 votes vote down vote up
def duplicate(self, *args):
        clipboard.copy(self)
        clipboard.paste(common.root) 
Example #9
Source File: edit_windows.py    From wxGlade with MIT License 5 votes vote down vote up
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 
Example #10
Source File: edit_base.py    From wxGlade with MIT License 5 votes vote down vote up
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)
    #################################################################################################################### 
Example #11
Source File: misc.py    From wxGlade with MIT License 5 votes vote down vote up
def _paste():
    if focused_widget is None: return
    if not hasattr(focused_widget, "clipboard_paste"):
        wx.Bell()
        return
    clipboard.paste(focused_widget) 
Example #12
Source File: misc.py    From wxGlade with MIT License 4 votes vote down vote up
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: