# -*- coding: utf-8 -*-from pyqt4.qtcore import pyqtsignaturefrom pyqt4.qtgui import qdialogfrom pyqt4 import qtgui,qtcorefrom ui_createkey Import ui_createkeyimport base64,uuidclass createkey (Qdialog, ui_createkey): def __init__ (Self, parent=none): qdialog. __init__ (self, parent) self.clipboard = QtGui.QApplication.clipboard () self.setupui (self) qtcore.qobject.connect (Self.pushbutton_3,qtcore.signal ("clicked ()"), Self.clear) qtcore.qobject.connect (self.pushButton_2, Qtcore.signal ("clicked ()"), Self.getkey) @pyqtSignature ("") def on_pushbutton_clicked (self): key = base64.b64encode (Uuid.uuid4 () .bytes + Uuid.uuid4 (). bytes) self.textbrowser.append (str (key)) @pyqtSignature ("") def clear (self): self.textbrowser.clear () @pyqtSignature ("") def getkey (self): self.clipboard.settext ( Self.textBrowser.toPlainText (). Split (' \ n ') [-1]) if __name__ == "__main__": import sys app = qtgui.qapplication (SYS.ARGV) ui = createkey () ui.show () sys.exit (App.exec_ ())
This article is from the "XWB" blog, make sure to keep this source http://xiewb.blog.51cto.com/11091636/1792299
Python Genetic random key tool