Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SketchWindow(wx.Window):
- def __init__(self, parent):
- wx.Window.__init__(self, parent, -1)
- self.SetBackgroundColour('White')
- # Window event binding
- self.Bind(wx.EVT_PAINT, self.OnPaint)
- self.Bind(wx.EVT_IDLE, self.OnIdle)
- # run
- self.Run()
- def OnPaint(self, evt):
- self.DrawEntities(wx.PaintDC(self))
- def DrawEntities(self, dc):
- dc.SetPen(wx.Pen('Black', 1, wx.SOLID))
- dc.SetBrush(wx.Brush('Green', wx.SOLID))
- # draw all
- for e in self.entities:
- x, y = e.location
- dc.DrawCircle(x, y, 4)
- def OnIdle(self, event):
- self.Refresh(False)
- def Run(self):
- # update self.entities ...
- # call this method again later
- wx.CallLater(50, self.Run)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement