zhouwenyou / pyuart

python serial
0 stars 0 forks source link

pyqt5 textedit setPlainText error #1

Open zhouwenyou opened 5 years ago

zhouwenyou commented 5 years ago

3.2 textedit显示问题   在showRecvMsg函数中,显示textedit数据时,当使用append()方法时没有问题,使用setPlainText()方法时程序出现错误,程序如下: def showRecvMsg(self, recvmsg): """ show receive message. msg = b'01 02 03 04 05' or b'x01\x02\x80\x00\xAA\xFF' """ s = self.bytesToStr(recvmsg, self.chkHexShow.isChecked()) self.txtRecvMsg.append(s)

self.txtRecvMsg.setPlainText(self.txtRecvMsg.toPlainText() + s)

        在按钮的关联事件中用setPlainText()方法显示textedit数据时正常。 def on_clearWin_clicked(self): s = "01 02 03 04" self.txtRecvMsg.setPlainText(self.txtRecvMsg.toPlainText() + s) return

zhouwenyou commented 5 years ago

Python 版本为: V3.7.4 PyQt版本为: V5.11.2