Here is part of the code:
以下是部分代码:
...
self.startButton.clicked.connect(self.conc_thread)
def conc(self):
self.textField.clear()
word=self.searchBox.text()
path=r'D:\python1\wxPython\NYConc\Fiction'
for filename in glob.glob(os.path.join(path, '*.txt')):
try:
file=open(filename, 'r')
read=file.read()
file.close()
pattern=re.findall(r'.{40} '+word+r' .{40}', read)
for i in pattern:
self.textField.append(i)
except:
continue
def conc_thread(self):
tg=threading.Thread(target=self.conc)
tg.start()
...