Python pyperclip 模块,copy() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用pyperclip.copy()

项目:master-calculator    作者:hesamkaveh    | 项目源码 | 文件源码
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.limit_button.clicked.connect(self.limittfunc)
        self.diffButton_normal.clicked.connect(self.diff_normal)
        self.diffButton_complex.clicked.connect(self.diff_complex)
        self.integralButton_normal.clicked.connect(self.integral_normal)
        self.integralButton_complex.clicked.connect(self.integral_complex)
        self.allCalculator.clicked.connect(self.allcalc)
        self.binomialButton.clicked.connect(self.binomialfunc)
        self.solver_button.clicked.connect(self.solver)
        self.sumButton.clicked.connect(self.sumfunc)
        self.factorButton.clicked.connect(self.factorfunc)
        self.fourierButton.clicked.connect(self.fourier)
        self.integralButton_copy.clicked.connect(self.copy)
        self.integralButton_copy_3.clicked.connect(self.copy)
        self.integralButton_copy_9.clicked.connect(self.copy)
        self.integralButton_copy_10.clicked.connect(self.copy)
        self.integralButton_copy_11.clicked.connect(self.copy)
        self.integralButton_copy_12.clicked.connect(self.copy)
        self.integralButton_copy_13.clicked.connect(self.copy)
        self.integralButton_copy_2.clicked.connect(self.copy)
        self.integralButton_copy_4.clicked.connect(self.copy)
项目:Cipherinpython    作者:EvanMu96    | 项目源码 | 文件源码
def main():
    my_message = 'If a man is offered a fact which goes against his instincts, he will scrutinize it closely, and unless the evidence is overwhelming, he will refuse to believe it. If, on the other hand, he is offered something which affords a reason for acting in accordance to his instincts, he will accept it even on the slightest evidence. The origin of myths is explained in this way. -Bertrand Russell'
    my_key = 'LFWOAYUISVKMNXPBDCRJTQEGHZ'
    my_mode = 'encrypt'

    # Check my_key is valid or not
    check_valid_key(my_key)

    if my_mode=='encrypt':
        translated = encrypt_message(my_key, my_message)
    elif my_mode=='decrypt':
        translated = decrypt_message(my_key, my_message)
    print('Using key %s' % my_key)
    print('THe %sed message is :' % my_mode)
    print(translated)
    pyperclip.copy(translated)
    print()
    print('This message has copied to clipboard')
项目:Cipherinpython    作者:EvanMu96    | 项目源码 | 文件源码
def main():
    if len(sys.argv) != 3:
        print('Usage: $python decrypt.py [filename] [key]')
        exit(1)
    try:
        f = open(sys.argv[1])
    except FileNotFoundError as e:
        print(e)
        exit(1)
    plain_text = f.read()
    key = int(sys.argv[2])
    cipher_text = decrypt_message(key, plain_text)
    print(cipher_text + '|')

    # Copy to clipboard
    pyperclip.copy(cipher_text)
    print('Plain text has save to clipboard')
项目:labutils    作者:networks-lab    | 项目源码 | 文件源码
def clip_df(df, tablefmt='html'):
    """
    Copy a dataframe as plain text to your clipboard.
    Probably only works on Mac. For format types see ``tabulate`` package
    documentation.

    :param pandas.DataFrame df: Input DataFrame.
    :param str tablefmt: What type of table?
    :return: None.
    """
    if tablefmt == 'material':
        html = tabulate.tabulate(df, headers=df.columns, tablefmt='html')
        html = html.replace('<table>', '<table class="mdl-data-table mdl-js-data-table">')
        header = '<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">\n<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">\n<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>'
        html = header + '\n' + html
    else:
        html = tabulate.tabulate(df, headers=df.columns, tablefmt=tablefmt)
    pyperclip.copy(html)
    print('Copied {} table to clipboard!'.format(tablefmt))
    return html
项目:torrench    作者:kryptxy    | 项目源码 | 文件源码
def copy_magnet(self, link):
        """Copy magnetic link to clipboard.

        This method is different from copylink_clipboard().
        This method handles the --copy argument.

        If --copy argument is supplied, magnetic link is copied to clipboard.
        """
        from torrench.Torrench import Torrench
        tr = Torrench()
        if tr.check_copy():
            try:
                pyperclip.copy(link)
                print("(Magnetic link copied to clipboard)")
            except Exception as e:
                print("(Unable to copy magnetic link to clipboard. Is [xclip] installed?)")
                print("(See logs for details)")
                self.logger.error(e)
        else:
            print("(use --copy to copy magnet to clipboard)")
项目:Adidas-Sitekey    作者:yousefissa    | 项目源码 | 文件源码
def product_search():
    # Checks the individual products for the recaptcha sitekey
    print("\nFound {} product links on page {}.\n".format(len(product_links), (params['start']+1)))
    index = 0
    for product in product_links:
        index += 1
        print('{} of {}: Checking for sitekey in: {}'.format(index + len(product_links)*(params['start']), len(product_links) * (params['start']+1), product))
        site_key_results = sitekey_scraper(str(product))
        if site_key_results:
            pyperclip.copy(site_key_results)
            print("\nFollowing Recaptcha Sitekey has been copied to clipboard:\n\n{}\n".format(
                site_key_results))
            return True
    return False

# # where the magic happens, u feel?
项目:passpy    作者:bfrascher    | 项目源码 | 文件源码
def get_command(self, ctx, cmd_name):
        """Allow aliases for commands.
        """
        if cmd_name == 'list':
            cmd_name = 'ls'
        elif cmd_name == 'search':
            cmd_name = 'find'
        elif cmd_name == 'gen':
            cmd_name = 'generate'
        elif cmd_name == 'add':
            cmd_name = 'insert'
        elif cmd_name in ['remove', 'delete']:
            cmd_name = 'rm'
        elif cmd_name == 'rename':
            cmd_name = 'mv'
        elif cmd_name == 'copy':
            cmd_name = 'cp'

        # TODO(benedikt) Figure out how to make 'show' the default
        # command and pass cmd_name as the first argument.
        rv = click.Group.get_command(self, ctx, cmd_name)
        if rv is not None:
            return rv
项目:passpy    作者:bfrascher    | 项目源码 | 文件源码
def cp(ctx, old_path, new_path, force):
    """Copies the password or directory names `old-path` to `new-path`.
    This command is alternatively named `copy`.  If `--force` is
    specified, silently overwrite `new_path` if it exists.  If
    `new-path` ends in a trailing `/`, it is always treated as a
    directory.  Passwords are selectively reencrypted to the
    corresponding keys of their new destination.

    """
    try:
        ctx.obj.copy_path(old_path, new_path, force)
    except StoreNotInitialisedError:
        click.echo(MSG_STORE_NOT_INITIALISED_ERROR)
        return 1
    except FileNotFoundError:
        click.echo('{0} is not in the password store.'.format(old_path))
        return 1
    except PermissionError:
        click.echo(MSG_PERMISSION_ERROR)
        return 1
    except RecursiveCopyMoveError:
        click.echo(MSG_RECURSIVE_COPY_MOVE_ERROR.format('copy'))
        return 1
项目:passman    作者:regexpressyourself    | 项目源码 | 文件源码
def clipboard(text,prnt, clear):
    '''
    Copy data to clipboard and start a thread to remove it after 20 seconds
    '''
    try:
        pyperclip.copy(text)
        print("Copied to clipboard")
    except:
        print("There was an error copying to clipboard. Do you have xsel installed?")
        quit()

    if prnt:
        print(text)
    if clear:
        global myThread
        if myThread and myThread.is_running():
            myThread.stop()
            myThread.join()
        myThread = StoppingThread(target=timer, args=(20,text,))
        myThread.start()
项目:py-works    作者:kutipense    | 项目源码 | 文件源码
def main(args):
    ext = {"py":"python3","cpp":"cpp","c":"c"}
    url = "https://paste.ubuntu.com/"
    with open(args) as f:
        file_name, syntax = sys.argv[1].rsplit("/")[-1].rsplit(".")

        payload = {
            "poster" : file_name,
            "syntax" : ext[syntax],
            "content" : str(f.read())
        }

        req = requests.post(url, data=payload)
        print(req.url)
        pyperclip.copy(str(req.url))
    return 0
项目:pvim    作者:Sherlock-Holo    | 项目源码 | 文件源码
def upload_img(file, arg):
    with open(file, 'rb') as f:
        start_time = time()
        ufile = requests.post(
            img_server,
            files={arg: f.read(),
                   'content_type': 'application/octet-stream'})
        end_time = time()
        url = ufile.text.split()[-1]
        usage_time = round(end_time - start_time, 2)
        print('upload time: {}s'.format(usage_time))

        try:
            pyperclip.copy(url)
        except NameError:
            pass
        except:
            pass

        return url
项目:pvim    作者:Sherlock-Holo    | 项目源码 | 文件源码
def upload_text(file, arg):
    postfix = file.split('.')[-1]
    with open(file, 'r') as f:
        start_time = time()
        ufile = requests.post(
            text_server,
            data={arg: f.read(),
                  'content_type': 'application/octet-stream'})
        end_time = time()
        url = ufile.text
        url = url.strip()
        url = url + "/{}".format(postfix)
        usage_time = round(end_time - start_time, 2)
        print('upload time: {}s'.format(usage_time))

        try:
            pyperclip.copy(url)
        except NameError:
            pass
        except:
            pass

        return url
项目:pvim    作者:Sherlock-Holo    | 项目源码 | 文件源码
def upload_pipe_test(arg):
    args = sys.stdin
    start_time = time()
    ufile = requests.post(
        text_server,
        data={arg: args.read(),
              'content_type': 'application/octet-stream'})
    end_time = time()
    url = ufile.text
    url = url.strip()
    usage_time = round(end_time - start_time, 2)
    print('upload time: {}s'.format(usage_time))

    try:
        pyperclip.copy(url)
    except NameError:
        pass

    return url


# opt
项目:pybble    作者:hiway    | 项目源码 | 文件源码
def build(file, copy):
    click.echo('Transpiling to Javascript...')
    t = envoy.run('transcrypt -p .none {}'.format(file))

    if t.status_code != 0:
        click.echo(t.std_out)
        sys.exit(-1)

    click.echo('Completed.')

    if copy is True:
        basename = os.path.basename(file)
        basename = os.path.splitext(basename)[0]
        basedir = os.path.dirname(file)
        fpath = os.path.join(basedir, '__javascript__/{}.min.js'.format(basename))
        with open(fpath, 'r') as minfile:
            pyperclip.copy(minfile.read())

        click.echo('Minified app.js copied to clipboard')
项目:Cipherinpython    作者:EvanMu96    | 项目源码 | 文件源码
def main():
    my_message = 'helloworld'
    #  Your Cipher key
    my_key = 3
    my_message = my_message.upper()
    # mode = 'decrypt'
    translated = caesar_cipher(my_message, my_key)
    # Save to clipboard
    pyperclip.copy(translated)
    print(translated)
    print('Cipher text has save to clipboard')
项目:Cipherinpython    作者:EvanMu96    | 项目源码 | 文件源码
def main():
    my_message = """Alan Mathison Turing was a British mathematician, logician
    , cryptanalyst, and computer scientist. He was highly influential in the d
    evelopment of computer science, providing a formalisation of the concepts of
     "algorithm" and "computation" with the Turing machine. Turing is widely con
     sidered to be the father of computer science and artificial intelligence. D
     uring World War II, Turing worked for the Government Code and Cypher School
      (GCCS) at Bletchley Park, Britain's codebreaking centre. For a time he was
       head of Hut 8, the section responsible for German naval cryptanalysis. He
        devised a number of techniques for breaking German ciphers, including the
         method of the bombe, an electromechanical machine that could find settin
         gs for the Enigma machine. After the war he worked at the National Physi
         cal Laboratory, where he created one of the first designs for a stored-pr
         ogram computer, the ACE. In 1948 Turing joined Max Newman's Computing Lab
         oratory at Manchester University, where he assisted in the development of
          the Manchester computers and became interested in mathematical biology.
          He wrote a paper on the chemical basis of morphogenesis, and predicted o
          scillating chemical reactions such as the Belousov-Zhabotinsky reaction,
          which were first observed in the 1960s. Turing's homosexuality resulted i
          n a criminal prosecution in 1952, when homosexual acts were still illegal
          in the United Kingdom. He accepted treatment with female hormones (chemical
           castration) as an alternative to prison. Turing died in 1954, just over
           two weeks before his 42nd birthday, from cyanide poisoning. An inquest
           determined that his death was suicide; his mother and some others believed
           his death was accidental. On 10 September 2009, following an Internet
           campaign, British Prime Minister Gordon Brown made an official public
           apology on behalf of the British government for "the appalling way he was
           treated." As of May 2012 a private member's bill was before the House of Lords
            which would grant Turing a statutory pardon if enacted."""

    print("Reverse Cipher")

    translated = reverse_cipher(my_message)
    print(translated)
    # Copy to clipboard
    pyperclip.copy(translated)
项目:Cipherinpython    作者:EvanMu96    | 项目源码 | 文件源码
def main():
    # replace your key and plain text
    my_message = 'Hello world'
    my_key = 5
    cipher_text = encrypt_message(my_key, my_message)
    print(cipher_text + '|')

    # Copy to clipboard
    pyperclip.copy(cipher_text)
    print('Cipher text has save to clipboard')
项目:cmd2    作者:python-cmd2    | 项目源码 | 文件源码
def write_to_paste_buffer(txt):
    """Copy text to the clipboard / paste buffer.

    :param txt: str - text to copy to the clipboard
    """
    pyperclip.copy(txt)
项目:cmd2    作者:python-cmd2    | 项目源码 | 文件源码
def __init__(self, obj, attribs):
        """Use the instance attributes as a generic key-value store to copy instance attributes from outer object.

        :param obj: instance of cmd2.Cmd derived class (your application instance)
        :param attribs: Tuple[str] - tuple of strings listing attributes of obj to save a copy of
        """
        self.obj = obj
        self.attribs = attribs
        if self.obj:
            self._save()
项目:master-calculator    作者:hesamkaveh    | 项目源码 | 文件源码
def checkForCopy(self, arg):
        if self.checkBox_copy.isChecked() == True:
            pyperclip.copy(str(arg))
项目:master-calculator    作者:hesamkaveh    | 项目源码 | 文件源码
def copy(self):
        pyperclip.copy(str(result))
项目:torrench    作者:kryptxy    | 项目源码 | 文件源码
def copylink_clipboard(self, link):
        """Copy Magnetic/Upstream link to clipboard"""
        try:
            self.logger.debug("Copying magnetic/upstream link to clipboard")
            pyperclip.copy(link)
            self.logger.debug("Copied successfully.")
            message = "Link copied to clipboard.\n"
            print(self.colorify("green", message))
        except Exception as e:
            print("Something went wrong.")
            print("Please make sure [xclip] package is installed.")
            print("See logs for details.\n\n")
            self.logger.error(e)
项目:cloud-clipboard    作者:krsoninikhil    | 项目源码 | 文件源码
def copy():
    """
    Returns the current text on clipboard.
    """
    data = pyperclip.paste()
    ## before using pyperclip
    # if os.name == "posix":
    #     p = subprocess.Popen(["xsel", "-bo"], stdout=subprocess.PIPE)
    #     data = p.communicate()[0].decode("utf-8")
    # elif os.name == "nt":
    #     data = None
    # else:
    #     print("We don't yet support %s Operating System." % os.name)
    #     exit()
    return data
项目:cloud-clipboard    作者:krsoninikhil    | 项目源码 | 文件源码
def upload(username, password):
    """
    Sends the copied text to server.
    """
    payload = {"text": copy(), "device": ""}
    res = requests.post(
        server_url+"copy-paste/",
        data = payload,
        auth = (username, password)
    )
    if res.status_code == 200:
        print("Succeses! Copied to Cloud-Clipboard.")
    else:
        print("Error: ", res.text)
项目:cloud-clipboard    作者:krsoninikhil    | 项目源码 | 文件源码
def paste(data):
    """
    Copies 'data' to local clipboard which enables pasting.
    """
    # p = subprocess.Popen(["xsel", "-bi"], stdout=subprocess.PIPE,
    #                      stdin=subprocess.PIPE)
    # p = p.communicate(data.encode("utf-8"))
    # if p[1] is not None:
    #     print("Error in accessing local clipboard")
    pyperclip.copy(data)
项目:cloud-clipboard    作者:krsoninikhil    | 项目源码 | 文件源码
def download(username, password):
    """
    Downloads from server and updates the local clipboard.
    """
    res = requests.get(server_url+"copy-paste/", auth=(username, password))
    if res.status_code == 200:
        paste(json.loads(res.text)["text"])
    else:
        print("Cannot download the data.")
项目:cloud-clipboard    作者:krsoninikhil    | 项目源码 | 文件源码
def usage():
    print("Error: Unknown argument")
    print("Usage: cloudcb.py copy|paste|register <email> <password>")
项目:Liljimbo-Chatbot    作者:chrisjim316    | 项目源码 | 文件源码
def set_data(self, data):
        assert isinstance(data, ClipboardData)
        self._data = data
        pyperclip.copy(data.text)
项目:leetcode    作者:thomasyimgit    | 项目源码 | 文件源码
def set_data(self, data):
        assert isinstance(data, ClipboardData)
        self._data = data
        pyperclip.copy(data.text)
项目:grab-screen    作者:andrei-shabanski    | 项目源码 | 文件源码
def copy_to_clipboard(text):
    """Writes a text to clipboard."""
    logger.info('Copying text to clipboard: %s', text)
    pyperclip.copy(text)
项目:mdimg    作者:zhiyue    | 项目源码 | 文件源码
def update_history_menu(self):
        self.historyMenu.clear()
        last = None
        for url in self.history['urls']:
            title = self.history['titles'][url]
            action = QtGui.QAction(title, self, triggered=partial(pyperclip.copy, url))
            self.historyMenu.insertAction(last, action)
            last = action
项目:mdimg    作者:zhiyue    | 项目源码 | 文件源码
def upload(self, name):
        key = os.path.basename(name)
        q = qiniu.Auth(self.access_key, self.secret_key)
        with open(name, 'rb') as img:
            data = img
            token = q.upload_token(self.bucket)
            ret, info = qiniu.put_data(token, key, data)
            if self.parseRet(ret, info):
                md_url = "![]({}/{})".format(self.domain, key)
                print(md_url)
                title = name
                pyperclip.copy(md_url)
                self.append_history(title, md_url)
项目:passpy    作者:bfrascher    | 项目源码 | 文件源码
def show(ctx, pass_name, clip, passthrough=False):
    """Decrypt and print a password named `pass-name`.  If `--clip` or
    `-c` is specified, do not print the password but instead copy the
    first line to the clipboard using pyperclip.  On Linux you will
    need to have xclip/xsel and on OSX pbcopy/pbpaste installed.

    """
    try:
        data = ctx.obj.get_key(pass_name)
    # If pass_name is actually a folder in the password store pass
    # lists the folder instead.
    except FileNotFoundError:
        if not passthrough:
            return ctx.invoke(ls, subfolder=pass_name, passthrough=True)
        else:
            click.echo(MSG_FILE_NOT_FOUND.format(pass_name))
            return 1
    except StoreNotInitialisedError:
        click.echo(MSG_STORE_NOT_INITIALISED_ERROR)
        return 1
    except PermissionError:
        click.echo(MSG_PERMISSION_ERROR)
        return 1

    if clip:
        pyperclip.copy(data.split('\n')[0])
        click.echo('Copied {0} to the clipboard.'.format(pass_name))
    else:
        # The key data always ends with a newline.  So no need to add
        # another one.
        click.echo(data, nl=False)
项目:passpy    作者:bfrascher    | 项目源码 | 文件源码
def generate(ctx, pass_name, pass_length, no_symbols, clip, in_place, force):
    """Generate a new password of length `pass-length` and insert into
    `pass-name`.  If `--no-symbols` or `-n` is specified, do not use
    any non-alphanumeric characters in the generated password.  If
    `--clip` or `-c` is specified, do not print the password but
    instead copy it to the clipboard.  On Linux you will need to have
    xclip/xsel and on OSX pbcopy/pbpaste installed.  Prompt before
    overwriting an existing password, unless `--force` or `-f` is
    specified.  If `--in-place` or `-i` is specified, do not
    interactively prompt, and only replace the first line of the
    password file with the new generated password, keeping the
    remainder of the file intact.

    """
    symbols = not no_symbols
    try:
        password = ctx.obj.gen_key(pass_name, pass_length, symbols,
                                   force, in_place)
    except StoreNotInitialisedError:
        click.echo(MSG_STORE_NOT_INITIALISED_ERROR)
        return 1
    except PermissionError:
        click.echo(MSG_PERMISSION_ERROR)
        return 1
    except FileNotFoundError:
        click.echo(MSG_FILE_NOT_FOUND.format(pass_name))
        return 1

    if password is None:
        return 1

    if clip:
        pyperclip.copy(password)
        click.echo('Copied {0} to the clipboard.'.format(pass_name))
    else:
        click.echo('The generated password for {0} is:'.format(pass_name))
        click.echo(password)
项目:QGIS-CKAN-Browser    作者:BergWerkGIS    | 项目源码 | 文件源码
def determine_clipboard():
    # Determine the OS/platform and set the copy() and paste() functions accordingly.
    if 'cygwin' in platform.system().lower():
        return init_windows_clipboard(cygwin=True)
    if os.name == 'nt' or platform.system() == 'Windows':
        return init_windows_clipboard()
    if os.name == 'mac' or platform.system() == 'Darwin':
        return init_osx_clipboard()
    if HAS_DISPLAY:
        # Determine which command/module is installed, if any.
        try:
            import gtk  # check if gtk is installed
        except ImportError:
            pass
        else:
            return init_gtk_clipboard()

        try:
            import PyQt4  # check if PyQt4 is installed
        except ImportError:
            pass
        else:
            return init_qt_clipboard()

        if _executable_exists("xclip"):
            return init_xclip_clipboard()
        if _executable_exists("xsel"):
            return init_xsel_clipboard()
        if _executable_exists("klipper") and _executable_exists("qdbus"):
            return init_klipper_clipboard()

    return init_no_clipboard()
项目:QGIS-CKAN-Browser    作者:BergWerkGIS    | 项目源码 | 文件源码
def set_clipboard(clipboard):
    global copy, paste

    if clipboard == 'osx':
        from .clipboards import init_osx_clipboard
        copy, paste = init_osx_clipboard()
    elif clipboard == 'gtk':
        from .clipboards import init_gtk_clipboard
        copy, paste = init_gtk_clipboard()
    elif clipboard == 'qt':
        from .clipboards import init_qt_clipboard
        copy, paste = init_qt_clipboard()
    elif clipboard == 'xclip':
        from .clipboards import init_xclip_clipboard
        copy, paste = init_xclip_clipboard()
    elif clipboard == 'xsel':
        from .clipboards import init_xsel_clipboard
        copy, paste = init_xsel_clipboard()
    elif clipboard == 'klipper':
        from .clipboards import init_klipper_clipboard
        copy, paste = init_klipper_clipboard()
    elif clipboard == 'no':
        from .clipboards import init_no_clipboard
        copy, paste = init_no_clipboard()
    elif clipboard == 'windows':
        from .windows import init_windows_clipboard
        copy, paste = init_windows_clipboard()
项目:QGIS-CKAN-Browser    作者:BergWerkGIS    | 项目源码 | 文件源码
def copy_clipboard(self):
        pyperclip.copy(self.IDC_plainTextLink.toPlainText())
项目:rice    作者:randy3k    | 项目源码 | 文件源码
def set_data(self, data):
        assert isinstance(data, ClipboardData)
        self._data = data
        pyperclip.copy(data.text)
项目:visionary    作者:spaceshuttl    | 项目源码 | 文件源码
def copy_to_clipboard(generated):
    global copied
    selection = safe_input('Which password would you like to copy? [1/2/3] ').strip()
    if selection in ['1', '2', '3']:
        password = generated[int(selection) - 1]
    else:
        print(color('Invalid option. Pick either 1, 2 or 3.\n', Fore.RED))
        return copy_to_clipboard(generated)
    try:
        pyperclip.copy(password)
        copied = True
        print('\nCopied!\n')
    except pyperclip.exceptions.PyperclipException:
        print(color('Could not copy! If you\'re using linux, make sure xclip is installed.\n', Fore.RED))
项目:visionary    作者:spaceshuttl    | 项目源码 | 文件源码
def exit(msg=''):
    if copied:
        pyperclip.copy('')
    if msg:
        print(color('\n%s' % msg, Fore.RED))
    print(color('\nExiting securely... You are advised to close this terminal.', Fore.RED))
    raise SystemExit
项目:xarvis    作者:satwikkansal    | 项目源码 | 文件源码
def copy_to_clipboard(text):
    current = pyperclip.paste()
    if (not clipboard) or (clipboard and clipboard[-1]!=current):
        clipboard.append(current)
    pyperclip.copy(text)
    clipboard.append(text)
项目:passman    作者:regexpressyourself    | 项目源码 | 文件源码
def clearclip(text=""):
    '''
    Clear the clipboard if nothing has been copied since data 
    was added to it
    '''
    if text == "":
        pyperclip.copy("")
    elif pyperclip.paste() == text:
        pyperclip.copy("")
项目:pyd3netviz    作者:gte620v    | 项目源码 | 文件源码
def to_clipboard(self):
        """ send viz to clipboard """
        pyperclip.copy(self.html)
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def set_data(self, data):
        assert isinstance(data, ClipboardData)
        self._data = data
        pyperclip.copy(data.text)
项目:chrome_remote_interface_python    作者:wasiher    | 项目源码 | 文件源码
def Input__paste(tabs, tab, data):
            try:
                backup = pyperclip.determine_clipboard()[1]() # Not sure if is correct D:
            except:
                backup = None
            pyperclip.copy(data)
            await tab.Input.press_key(tabs.helpers.keyboard.PASTE)
            if backup is not None:
                pyperclip.copy(backup)
项目:img2url    作者:huntzhan    | 项目源码 | 文件源码
def entry_point():
    args = docopt(DOC, version=VERSION)

    path = args['<path>']
    doc_type = get_doc_type(args)

    fields = load_config(locate_config())

    # load operator.
    remote = fields.get(CONFIG_REMOTE, 'github')
    if remote not in REGISTERED_REMOTES:
        raise RuntimeError(
            'FATAL: {0} is not a valid remote type.'.format(remote),
        )
    RemoteConfig, RemoteOperation = REGISTERED_REMOTES[remote]

    ret_fname, resource_url = upload_file(
        path, fields, RemoteConfig, RemoteOperation,
    )

    url = translate_url(
        ret_fname,
        resource_url,
        doc_type,
    )

    if not args['--no-clipboard']:
        pyperclip.copy(url)

    print(url)
项目:YtbDwn    作者:praneet95    | 项目源码 | 文件源码
def Copy_exit(button,choice):       ####called when user selects copy to clipboard
        pyperclip.copy(str(choice.url))
        spam = pyperclip.paste()
        sys.exit()
项目:FitScan    作者:GunfighterJ    | 项目源码 | 文件源码
def __init__(self, MainWindow, parent=None):
        super(ClipThread, self).__init__(parent)
        self.window = MainWindow
        pyperclip.copy('')
        self.last_clipboard = ''
        self.active = True
项目:FitScan    作者:GunfighterJ    | 项目源码 | 文件源码
def copyFitting(self):
        self.stopClipboard()
        fit = []
        ship = self.shipName if self.shipName else 'Metal Scraps'
        fit.append("[{}, New Fit]".format(ship))
        for key in self.mapped_items:
            for item in self.mapped_items[key]["items"]:
                fit.append(item)
            fit.append('')

        pyperclip.copy('')
        pyperclip.copy("\n".join(fit))
项目:repo    作者:austinHeisleyCook    | 项目源码 | 文件源码
def copytext(self):
        self.Copiedtext = pyperclip.copy(self.contents.get(1.0, END))