def runcommand():
p = threading.Thread(target=step)
p.setDaemon(True)
p.start()
cmd = cmdtextbox.get()
cmd_result = subprocess.run(cmd,shell=True,capture_output=True,text=True)
output = cmd_result.stdout
filter_function = filter(lambda w: 'IPv4 address',output)
outputtextbox.insert(END,output,filter_function)
outputlabel['text']='OUTPUT'
outputlabel.config(fg="green")
cmdtextbox['state'] ='normal'
runbtn['state'] = 'normal'
p.join()
progress.grid_remove()
先过滤再插入啊,用正则啊