__main__.py

This commit is contained in:
Tan, Kian-ting 2016-03-30 08:08:27 +08:00
parent 3ef6cd5b3b
commit 43162d553f

View file

@ -3,7 +3,7 @@
import sqlite3
import sys
import ui, ui2
from PyQt4 import QtGui
from PyQt4 import QtGui, QtCore
def table2list(table_tsv):
with open(table_tsv,'r',encoding='utf-16') as tsv:
@ -85,9 +85,9 @@ class MainWindow(QtGui.QMainWindow, ui.Ui_MainWindow):
self.pushButton.clicked.connect(self.input_characters)
def input_characters(self):
characters = self.lineEdit.text()
chinese_char_pattern = QtCore.QRegExp("[\x{4e00}-\x{9fa5}]+")
chinese_char_pattern = QtCore.QRegExp("[\u4e00-\u9fa5]+")
validator = QtGui.QRegExpValidator( chinese_char_pattern, characters)
if validator.validare():
if validator.validate():
print (characters)
else:
print("error")