

def OnSaveAs(self, event):
    'Save contents of output window.'
    with wx.FileDialog(None, 'Save Text As...', '.', '', 'Text File|*.txt|All Files|*', wx.SAVE) as dlg:
        if (event.ShowModal() == wx.ID_OK):
            filename = dlg.GetPath()
            with codecs.open(filename, 'w', encoding='utf-8') as f:
                text = self.text_ctrl_output.GetValue().encode('utf-8')
                f.write(text)

dataset/ETHPy150Open pyserial/pyserial/examples/wxTerminal.py TerminalFrame.OnSaveAs/VarMisuse@40/74 `dlg`->`event`