from PySide.QtGui import QApplication, QClipboard app = QApplication([]) clipboard = app.clipboard() clipboard.setText('Hello, world!')
from PySide.QtGui import QApplication, QClipboard app = QApplication([]) clipboard = app.clipboard() text = clipboard.text() print(text)In this code, the `text` method of the QClipboard instance is used to retrieve the current contents of the clipboard, which is then printed to the console. Package library: PySide.