コード例 #1
0
def readSelected():
	clipBoardInstance = Clipboard(from_system=True)
	# make a temporary clipboard, with the message didn't found selected text, and clone it to system.
	temporary = Clipboard({Clipboard.format_unicode: u"didn't found selected text."})
	temporary.copy_to_system()

	# copy new text to this set clipboard. If no text selected the text "didn't found selected text." remains on clipboard
 	Key("c-c/25").execute()
 	text = Clipboard(from_system=True).get_text()
	sayOutLoud(text.encode('utf8'))

	# set the first obtained clipboard back to the system.
	clipBoardInstance.copy_to_system()