+ 1
do you know how to implement this?
I want to do in tkinter program on python the code in which there will be input field, and when you click on button this text from input field will be copied to the clipboard in python
3 ответов
+ 2
I found this solution on stack overflow.
from tkinter import Tk # in Python 2, use "Tkinter" instead
r = Tk()
r.withdraw()
r.clipboard_clear()
r.clipboard_append('i can has clipboardz?')
r.update() # now it stays on the clipboard after the window is closed
r.destroy()
Another comment suggested that once you do the r.destroy() that the clipboard is erased, so consider skipping that last line. I've not tested this code.
+ 1
ok, I'll watch it
+ 1
Jerry Hobby thanks it works.