def _onPaint(self, evt): """ Overrides the :class:`FigureCanvasWxAgg` paint event to redraw the crosshairs, etc. """ # We have now dc = wx.ClientDC(self) if self.repaintEnabled: # Clear the crosshairs and the rubberband from the whole area # This will damage the area that will be repainted, but after repaint # it will be OK. ch=self.crosshairs.clear(dc) rb=self.rubberband.clear(dc) del dc FigureCanvasWxAgg._onPaint(self, evt) # At this point the figure should be complete clear of any crosshairs or rubberband # Now paint the crosshairs and the rubberband on the whole area dc = wx.ClientDC(self) self.crosshairs.redraw(dc, ch) self.rubberband.redraw(dc, rb) del dc dc = wx.PaintDC(self)
def _onPaint(self, evt): """ Overrides the C{FigureCanvasWxAgg} paint event to redraw the crosshairs, etc. """ # avoid wxPyDeadObject errors if not isinstance(self, FigureCanvasWxAgg): return self.insideOnPaint = True FigureCanvasWxAgg._onPaint(self, evt) self.insideOnPaint = False dc = wx.PaintDC(self) self.location.redraw(dc) self.crosshairs.redraw(dc) self.rubberband.redraw(dc)
def _onPaint(self, evt): def scale_bitmap(figure_image, bitmap): h, w, d = figure_image.shape bitmapw, bitmaph = bitmap.GetSize() image = wxEmptyImage(w, h) image.SetData(figure_image[:,:,0:3].tostring()) image_SetAlpha(image, figure_image[:,:,3]) return image.Scale(csize[0], csize[1]).ConvertToBitmap() csize = self.GetClientSize() if self.figure_image is not None: h, w, d = self.figure_image[0].shape if (csize[0] != w or csize[1] != h) : self.bitmap = scale_bitmap(self.figure_image[0], self.bitmap) self._isDrawn=True else: self._isDrawn = False CanvasAgg._onPaint(self, evt)
def _onPaint(self, event): #print '$$$ _onPaint ex : call default _onPaint' FigureCanvas._onPaint(self, event) #print '$$$ _onPaint ex : call drawAllObjects in parent' self.m_parent.drawAllObjects()