def __init__(self, parent=None, id=-1, title=None):
wx.Frame.__init__(self, parent, id, title)
self.MainPanel = wx.Panel(self, size=(640, 640))
self.MainPanel.SetBackgroundColour('WHITE')
self.panel = wx.Panel(self.MainPanel, size = (640,480))
self.panel.SetBackgroundColour('WHITE')
self.plotter = plot.PlotCanvas(self.MainPanel, size =(640, 640-480))
self.plotter.SetEnableZoom(False)
self.plotter.SetEnableLegend(True)
self.plotter.SetFontSizeLegend(10.5)
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(self.panel)
mainSizer.Add(self.plotter)
self.SetSizer(mainSizer)
self.Fit()
self.A = Agent(self.panel, 240, 49 )
self.B = Agent(self.panel, 240, 49)
self.B.B_color = wx.Colour(112,173,71)
# OutrBox
self.Box = Walls(640, 479, 0, 479)
self.Box.addPoint(0,0)
self.Box.addPoint(640,0)
self.Box.addPoint(640,479)
# Oval Course
Rad = 190.0
Poly = 16
self.Course = Walls(240, 50, 640-(50+Rad),50)
for i in range(1, Poly):
self.Course.addPoint(Rad*math.cos(-np.pi/2.0 + np.pi*i/Poly)+640-(50+Rad),
Rad*math.sin(-np.pi/2.0 + np.pi*i/Poly)+50+Rad)
self.Course.addPoint(240, 50+Rad*2)
for i in range(1, Poly):
self.Course.addPoint(Rad*math.cos(np.pi/2.0 + np.pi*i/Poly)+(50+Rad),
Rad*math.sin(np.pi/2.0 + np.pi*i/Poly)+50+Rad)
self.Course.addPoint(240,50)
self.Bind(wx.EVT_CLOSE, self.CloseWindow)
self.cdc = wx.ClientDC(self.panel)
w, h = self.panel.GetSize()
self.bmp = wx.EmptyBitmap(w,h)
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnTimer)
self.timer.Start(20)
self.i = 0
self.tmp_sum = 0.0
self.data = []
评论列表
文章目录