How do I copy a string to the clipboard on Windows using Python?

后端 未结 23 2808
温柔的废话
温柔的废话 2020-11-22 03:13

I\'m trying to make a basic Windows application that builds a string out of user input and then adds it to the clipboard. How do I copy a string to the clipboard using Pytho

23条回答
  •  长情又很酷
    2020-11-22 03:28

    Widgets also have method named .clipboard_get() that returns the contents of the clipboard (unless some kind of error happens based on the type of data in the clipboard).

    The clipboard_get() method is mentioned in this bug report:
    http://bugs.python.org/issue14777

    Strangely, this method was not mentioned in the common (but unofficial) online TkInter documentation sources that I usually refer to.

提交回复
热议问题