def draw_box(self, n, box, color, style, num):
x1, y1, x2, y2 = box.left(), box.top(), box.right(), box.bottom()
x1 = int(x1 * self.i_scale[n])
y1 = int(y1 * self.i_scale[n])
x2 = int(x2 * self.i_scale[n])
y2 = int(y2 * self.i_scale[n])
width = BASEWIDTH
if style == 'match':
width *= 2
painter = QPainter(self.i_pixmap[n])
painter.setPen(QPen(QBrush(color), width))
painter.drawRect(x1, y1, x2 - x1, y2 - y1)
painter.setPen(QPen(QBrush(TEXTCOLOR), TEXTWIDTH))
painter.setFont(TEXTFONT)
painter.drawText(x1, y2 + TEXTSIZE + 2 * BASEWIDTH, '{}: {}'.format(n + 1, num))
painter.end()
self.i_lbl[n].setPixmap(self.i_pixmap[n])
评论列表
文章目录