Hello,

I want to write a wxPython script to pull up pylab plots (in a separate 
window), 
based on menu or button choices.  The script below crashes with a segmentation 
fault. 
  Am I doing something wrong here?  Is there a workaround or fix?



                        thanks,


                                Brian Blais

#!/usr/bin/env python

from wxPython.wx import *
import pylab

class MyFrame(wxFrame):

     def __init__(self, parent, id, title):
         wxFrame.__init__(self, parent, -1, title)
         self.CenterOnScreen()

         menuBar = wxMenuBar()

         # 1st menu from left
         menu1 = wxMenu()
         menu1.Append(101, "&New")
         menu1.Append(102, "&Close", "Close this frame")
         menuBar.Append(menu1, "&File")
         EVT_MENU(self, 101, self.New)
         EVT_MENU(self, 102, self.Close)

         self.SetMenuBar(menuBar)
         self.Show(True)

     def New(self, event):
         pylab.plot([1,2,3,4],[5,6,7,8])
         pylab.show()

     def CloseWindow(self, event):
         self.Close()


class App(wxApp):
     def OnInit(self):
         frame = MyFrame(None, -1, "testing")
         self.SetTopWindow(frame)
         return True

def main():

     app = App(0)
     app.MainLoop()


if __name__ == "__main__":
     main()


-- 
-----------------

              [EMAIL PROTECTED]
              http://web.bryant.edu/~bblais


_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to