Hi,
I have made a very simple plot.
However, it works only once. after closing the plotting, a second time plot will raise some error message.
just run the script and click the menu item to plot. close the plot. and then click the plot again. then the plotting is frozen.
Anything wrong I have made?
import wx
from pylab import *
class MyFrame(wx.Frame):
ββ"
This is MyFrame. It just shows a few controls on a wxPanel,
and has a simple menu.
ββ"
def init(self, parent, title):
wx.Frame.init(self, parent, -1, title,
pos=(150, 150), size=(350, 200))
# Create the menubar
menuBar = wx.MenuBar()
# and a menu
menu = wx.Menu()
menu.Append(100, "P&lot\tAlt-P")
# bind the menu event to an event handler
self.Bind(wx.EVT_MENU, self.OnPlot, id=100)
# and put the menu on the menubar
menuBar.Append(menu, "&File")
self.SetMenuBar(menuBar)
self.CreateStatusBar()
# Now create the Panel to put the other controls on.
def OnPlot(self, evt):
"""Event handler for the button click."""
#print "Having fun yet?"
plot([1,2,3])
show()
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, βSimple wxPython Appβ)
self.SetTopWindow(frame)
thanks
n.ye
frame.Show(True)
return True
app = MyApp(0)
app.MainLoop()