This came up, maybe it is usefull to somebody. Later I plan to do a managing context interface to with
statement for this.
Using clipboard from Python
# Based on http://snippets.dzone.com/posts/show/724:
import win32clipboard as w
import win32con
from time import sleep
def get_text():
w.OpenClipboard()
d = w.GetClipboardData(win32con.CF_TEXT)
w.CloseClipboard()
return d
def set_text(to_put, the_type=w.CF_TEXT):
w.OpenClipboard()
w.EmptyClipboard()
w.SetClipboardData(the_type,to_put)
w.CloseClipboard()
def clipboard_wait():
set_text('')
# wait text to enter clipboard
while not (get_text()):
sleep(0.1)
return get_text()
print(clipboard_wait())
TrustyTony 888 pyMod Team Colleague Featured Poster
TrustyTony 888 pyMod Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.