def OnSize(self, event):
# The Buffer init is done here, to make sure the buffer is always
# the same size as the Window
Size = self.canvas.GetClientSize()
if Size.width <= 0 or Size.height <= 0:
return
Size.width = max(1, Size.width)
Size.height = max(1, Size.height)
# Make new offscreen bitmap: this bitmap will always have the
# current drawing in it, so it can be used to save the image to
# a file, or whatever.
#self._Buffer = wx.Bitmap(Size.width, Size.height)
if IsNotWX4():
self._img = wx.EmptyImage(Size.width,Size.height)
self._Buffer = wx.BitmapFromImage(self._img)
else:
self._img = wx.Image(Size.width,Size.height)
self._Buffer = wx.Bitmap(self._img)
self._Buffer.SetHeight(Size.height)
self._Buffer.SetWidth(Size.width)
self._setSize()
self.last_PointLabel = None # reset pointLabel
if self.last_draw is None:
self.Clear()
else:
graphics, xSpec, ySpec = self.last_draw
self._Draw(graphics, xSpec, ySpec)
评论列表
文章目录