def draw_box(self):
x1, x2 = self.plot._point2ClientCoord(*self.selected)[::2]
dc = wx.ClientDC(self.plot.canvas)
dc.SetLogicalFunction(wx.INVERT)
dc.DrawRectangle(x1, 0, x2, dc.GetSize()[1])
dc.SetLogicalFunction(wx.COPY)
# def clear(self):
# # An experimental way to clear the canvas without redrawing the plot every time
# # dc.Blit() usage from SOF.
# if self.selection_drawn:
# self.draw_box() # clear old
# self.selection_drawn = False
# dc = wx.ClientDC(self.plot.canvas)
# size = dc.GetSize()
# bmp = wx.Bitmap(size.width, size.height)
# prev_dc = wx.MemoryDC()
# prev_dc.SelectObject(bmp)
# prev_dc.Blit(
# 0, # Copy to this X coordinate
# 0, # Copy to this Y coordinate
# size.width, # Copy this width
# size.height, # Copy this height
# dc, # From where do we copy?
# 0, # What's the X offset in the original DC?
# 0 # What's the Y offset in the original DC?
# )
# prev_dc.SelectObject(wx.NullBitmap)
# dc.Clear()
# dc.DrawBitmap(bmp, 0, 0)
# # if self.plot.last_draw is not None:
# # self.plot.Draw(self.plot.last_draw[0])
评论列表
文章目录