Changeset 6482
- Timestamp:
- Mar 10, 2009, 2:23:46 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/tools/plotcsv/plotcsv.py
r6480 r6482 159 159 "zNHrrf9oCIxPMrO3N4LXSYQhEMeNpmcCKVywaA43JUYjwPeBTqcx3BIIOYTHHi74YjP4F4OI" 160 160 "IIgI9JOI2kS0JKI/m33TfzU+ASG0bvT61fpzAAAAAElFTkSuQmCC") 161 162 163 def error(msg):164 print msg165 import tkinter_error166 tkinter_error.tkinter_error(msg)167 sys.exit(10)168 161 169 162 … … 290 283 x_index = header.index(x_hdr) 291 284 except ValueError: 292 error("Sorry, X column header '%s' isn't in data file '%s'." 293 % (x_hdr, filename)) 285 TheFrame.error("Sorry, X column header '%s' isn't in data file '%s'." 286 % (x_hdr, filename)) 287 return None 294 288 295 289 try: 296 290 y_index = header.index(y_hdr) 297 291 except ValueError: 298 error("Sorry, Y column header '%s' isn't in data file '%s'." 299 % (y_hdr, filename)) 292 TheFrame.error("Sorry, Y column header '%s' isn't in data file '%s'." 293 % (y_hdr, filename)) 294 return None 300 295 301 296 # get appropriate columns from data[] … … 324 319 325 320 for f in filenames: 326 (x_data, y_data) = getCSVData(f, x_hdr, y_hdr) 321 result = getCSVData(f, x_hdr, y_hdr) 322 if result is None: # some sort of error 323 pylab.close() 324 return 325 326 (x_data, y_data) = result 327 327 pylab.plot(x_data, y_data) 328 328 … … 354 354 # Make the frame 355 355 wx.Frame.__init__(self, parent, id, title, pos=(50, 50), 356 357 358 359 356 size=(FORM_WIDTH, FORM_HEIGHT), 357 style=(wx.DEFAULT_FRAME_STYLE & 358 ~ (wx.RESIZE_BOX | wx.MAXIMIZE_BOX | 359 wx.RESIZE_BORDER))) 360 360 361 361 p = self.panel = wx.Panel(self, -1) … … 629 629 '''Issue xwPython error message.''' 630 630 631 dlg = wx.MessageDialog(self, msg, 'Error', 632 wx.OK | wx.ICON_INFORMATION) 633 dlg.ShowModal() 634 dlg.Destroy() 631 wx.MessageBox(msg, 'Error') 635 632 636 633 … … 640 637 641 638 if __name__ == '__main__': 639 global TheFrame 640 641 # The frame reference 642 TheFrame = None 643 642 644 app = wx.App() 643 frame = MyFrame(None, -1, '%s %s' % (APP_NAME, APP_VERSION),644 size=(FORM_WIDTH, FORM_HEIGHT))645 app.SetTopWindow( frame)645 TheFrame = MyFrame(None, -1, '%s %s' % (APP_NAME, APP_VERSION), 646 size=(FORM_WIDTH, FORM_HEIGHT)) 647 app.SetTopWindow(TheFrame) 646 648 app.MainLoop() 647 649
Note: See TracChangeset
for help on using the changeset viewer.