def OnTBLoad(self, event):
if self.running:
rng = True
self.OnTBStart()
else:
rng = False
dlg = wx.FileDialog(None, "Open Spectrum", os.getcwd(), "", "*.*", wx.OPEN)
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
tmpx, tmpy = np.loadtxt(filename, unpack=True)
# add to plot window
self.addLine(tmpx, tmpy)
dlg.Destroy()
if rng:
self.OnTBStart()
评论列表
文章目录