如何在使用 WxWidgets 从串行端口读取时不断更新我的面板绘图

How can I constantly update my panel drawing while reading from the serial port using WxWidgets

本文关键字:更新 我的 绘图 读取 WxWidgets 串行端口      更新时间:2023-10-16

我正在使用WxWidgets在C++中创建表单应用程序,我需要在从串行端口接收数据时绘制图形。如何做到这一点?我的序列号工作正常。我只需要能够不断接收串行数据并更新我的图表。

我是事件驱动编程的新手,我正在使用代码块。我可以使用事件吗?是否可以在事件中使用 while 循环,我试过这个,程序崩溃了。

谢谢。

最好的解决方案是将处理串行端口的代码移动到单独的线程,并将事件从该线程发布到主线程以更新 GUI。