from PyQt4 import QtGui
from PyQt4 import QtCore
class TransCHCharacterForPython(QtGui.QDialog):
def init(self, parent = None):
QtGui.QDialog.init(self, parent)
self.inputText = QtGui.QLineEdit()
self.pushBttuon = QtGui.QPushButton(u’TransformCHCharacter’)
self.outputText = QtGui.QTextEdit()
hboxLayout = QtGui.QVBoxLayout()
hboxLayout.addWidget(self.inputText)
hboxLayout.addWidget(self.pushBttuon)
hboxLayout.addWidget(self.outputText)
# mainLayout = QtGui.QGridLayout()
# mainLayout.addLayout(hboxLayout, 0, 0, 1, 2)
self.setLayout(hboxLayout)
self.setWindowTitle(u’TransCHCharacterForPython’)
self.setFixedHeight(260)
self.setFixedWidth(210)
self.signals()
def transCharacter(self):
sum = ”
chineseChar = self.inputText.text()
for item in str(chineseChar):
sum = sum + item
# unicodeChar.append(sum)
self.outputText.setText(str(sum))
def signals(self):
self.pushBttuon.clicked.connect(self.transCharacter)
if name == ‘main‘:
import sys
app = QtGui.QApplication(sys.argv)
transCharacter = TransCHCharacterForPython()
transCharacter.show()
sys.exit(app.exec_())