修改一个串口程序,打印信息在text区域中可以正常显示。就是满屏后,每次更新过来的信息不能自动显示出来。他总是在第一页不往下滚动;
通过google找到方法如下:
def OnSerialRead(self, event): """Handle input from the serial port.""" text = event.data if self.settings.unprintable: text = ''.join([(c >= ' ') and c or '<%d>' % ord(c) for c in text]) self.text_ctrl_output.AppendText(text) self.text_ctrl_output.ScrollLines(1) self.text_ctrl_output.ShowPosition(self.text_ctrl_output.GetLastPosition ())
添加上红色部分即可.
如下图,在右边的scroll bar的adjuster在最下面: