def DisplayImage(self):
if self.current_image:
tw = self.static_bitmap.GetSize().GetWidth()
th = self.static_bitmap.GetSize().GetHeight()
sw = self.current_image.GetSize().GetWidth()
sh = self.current_image.GetSize().GetHeight()
#self.scale = min(tw/float(sw),th/float(sh))
tw = int(sw*self.scale)
th = int(sh*self.scale)
im = self.current_image.Copy()
im.Rescale(tw,th)
bm = im.ConvertToBitmap()
bmdc = wx.MemoryDC(bm)
bmdc.SetBrush(wx.TRANSPARENT_BRUSH)
bmdc.SetPen(wx.RED_PEN)
bmdc.SetTextForeground(wx.RED)
i = 1
for point in self.coords[self.image_name]:
bmdc.DrawCircle(self.scale*point[0], self.scale*point[1], 5)
w,h = bmdc.GetTextExtent(str(i))
bmdc.DrawText(str(i),self.scale*point[0]-w/2, self.scale*point[1]+5)
i += 1
del bmdc
self.static_bitmap.SetBitmap(bm)
# ------------- Event Handlers ---------------
评论列表
文章目录