pyUVVIS.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:pyUVVIS 作者: ddietze 项目源码 文件源码
def OnTBSave(self, event):
        if self.data is None:
            wx.MessageBox('Please record a spectrum first!', 'Save Spectrum', wx.OK | wx.ICON_INFORMATION)
            return
        if self.running:
            rng = True
            self.OnTBStart()
        else:
            rng = False

        dlg = wx.FileDialog(None, "Save Spectrum", os.getcwd(), "", "*.*", wx.SAVE)
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetPath()

            # set new working directory
            directory = os.path.split(filename)
            if not os.path.isdir(filename):
                os.chdir(directory[0])

            # save file
            np.savetxt(filename, np.transpose(np.array([self.wlAxis, self.data])))

            # add to plot window
            self.addLine(self.wlAxis, self.data)
        dlg.Destroy()

        if rng:
            self.OnTBStart()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号