GUI Python UART-data monitor . and output a json file to save log

My question is when i use com2 send out data like [22,133,148,156,222], at the same time i could monitor my send data, and get chips feedback saves into jason/txt files.

yes. I suggest getting your tool working as a cmd-line app, then adding GUI on top. Printing data to the stdout vs appending it to a TextCtrl, or you can even replace the sys.stdout with a class that has a write method like:

class RedirectText:
    def __init__(self, text_ctrl, std_strm):
        self.out = text_ctrl
        self.orig_stdstrm = std_strm

    def write(self, string):
        wx.CallAfter(self.out.AppendText, string)
        self.orig_stdstrm.write(string)

here’s how I use it to create a widget and connect it:

    def create_log_panel(self, main_and_log_splitter):
        # add log area for stdout/stderr
        self.log = wx.TextCtrl(main_and_log_splitter, style=wx.TE_MULTILINE | wx.TE_READONLY)
        self.log.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.log.SetForegroundColour(wx.Colour(0, 0, 0))
        self.log.SetFont(wx.Font(10, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))

        # Redirect stdout and stderr
        sys.stdout = RedirectText(self.log, sys.stdout)
        sys.stderr = RedirectText(self.log, sys.stderr)

        return self.log