法一:?
# 向文本框中添加字符串,自動換行,不會覆蓋之前的內容 self.textEdit.append(datetime.datetime.strftime(datetime.datetime.now(),"%Y-%m-%D %H:%M:%S")+" 共%d個文件,剩余%d個文件,耗時%.5f(s)"%(excelNum,curindex,duration))# 向文本框中寫入字符串,會覆蓋之前的內容 self.textEdit.setText(datetime.datetime.strftime(datetime.datetime.now(),"%Y-%m-%D %H:%M:%S")+" 計算中:%s"%xlsPath)# 當文本內容長度超過文本框的高度時,會出現滑條,滑條始終在最底端 self.textEdit.verticalScrollBar().setValue(self.textEdit.verticalScrollBar().maximum())
法二:
self.textEdit_6.moveCursor(QTextCursor.End)
?