Skip to content

Instantly share code, notes, and snippets.

@weijia
Last active August 29, 2015 14:05
Show Gist options
  • Save weijia/55820d9a4349bc675bd8 to your computer and use it in GitHub Desktop.
Save weijia/55820d9a4349bc675bd8 to your computer and use it in GitHub Desktop.
PyQt clipboard event capture
#!/usr/bin/env python
#coding=utf-8
import sys
from PyQt4 import QtGui, QtCore
import os
def notification():
print "good"
if __name__ == '__main__':
print "OS Name:"+os.name
app = QtGui.QApplication(sys.argv)
edit = QtGui.QLineEdit()
edit.setText('foo bar')
edit.show()
app.clipboard().dataChanged.connect(notification)
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment