당신은 당신이 다음 캡처하고 싶은 당신의 결합 경계하는 구형을 얻을 QPixmap
에 그것을 렌더링합니다. 이 시점에서 QPixmap
을 저장할 수 있습니다.
테스트되지 않은,하지만의 라인을 따라해야 ...
import operator
items = get_target_items() # just get all the items you want
# combine all the scene rects for the items
# equiv: totalRect = rect1 | rect2 | ...
totalRect = reduce(operator.or_, (i.sceneBoundingRect() for i in items))
pix = QtGui.QPixmap(totalRect.width(), totalRect.height())
painter = QtGui.QPainter(pix)
scene.render(painter, totalRect)
pix.save("capture.jpg", "JPG")
출처
2012-12-21 05:25:01
jdi