def on_export_db(self, event): # wxGlade: admin_dash.<event_handler>
import time
mytime=time.localtime()# returns year, month,date,etc
filename="Full_DB_"+str(mytime[2])+"_"+str(mytime[1])+"_"+str(mytime[0])
wcd="Exam Files(*.xam)|*.xam|"
dir = "/home"
save_dlg = wx.FileDialog(self, message='Save file as...', defaultDir=dir, defaultFile= filename, wildcard=wcd, style=wx.SAVE | wx.OVERWRITE_PROMPT)
if save_dlg.ShowModal() == wx.ID_OK:
path = save_dlg.GetPath()
try:
self.DB.export(path+".xam")
dlg = wx.MessageDialog(self, 'Successfully Exported', '',wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
except:
dlg = wx.MessageDialog(self, 'Error Exporting file\n' )
dlg.ShowModal()
save_dlg.Destroy()
self.label_export.SetForegroundColour(self.label_fg_color)
event.Skip()
评论列表
文章目录