# and the refresh event
EVT_PAINT(self, self.OnPaint)
+ # When the window is destroyed, clean up resources.
+ EVT_WINDOW_DESTROY(self, self.Cleanup)
- def __del__(self):
- self.Cleanup()
-
- def Cleanup(self):
+ def Cleanup(self, evt):
if hasattr(self, "menu"):
self.menu.Destroy()
del self.menu
dc.SetBackground(wxBrush(self.GetBackgroundColour()))
dc.Clear()
self.DrawLines(dc)
- self.reInitBuffer = false
+ self.reInitBuffer = False
def SetColour(self, colour):
def OnCheckMenuColours(self, event):
text = self.menuColours[event.GetId()]
if text == self.colour:
- event.Check(true)
+ event.Check(True)
else:
- event.Check(false)
+ event.Check(False)
def OnCheckMenuThickness(self, event):
if event.GetId() == self.thickness:
- event.Check(true)
+ event.Check(True)
else:
- event.Check(false)
+ event.Check(False)
def OnLeftDown(self, event):
Called when the window is resized. We set a flag so the idle
handler will resize the buffer.
"""
- self.reInitBuffer = true
+ self.reInitBuffer = True
def OnIdle(self, event):
"""
if self.reInitBuffer:
self.InitBuffer()
- self.Refresh(FALSE)
+ self.Refresh(False)
def OnPaint(self, event):
if __name__ == '__main__':
app = wxPySimpleApp()
frame = DoodleFrame(None)
- frame.Show(true)
+ frame.Show(True)
app.MainLoop()