本文整理汇总了Python中PyQt4.QtGui.QPrinter.resolution方法的典型用法代码示例。如果您正苦于以下问题:Python QPrinter.resolution方法的具体用法?Python QPrinter.resolution怎么用?Python QPrinter.resolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QPrinter
的用法示例。
在下文中一共展示了QPrinter.resolution方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_pdf
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import resolution [as 别名]
def print_pdf(self):
if self.deck is not None:
#Setting the printer
printer = QPrinter(QPrinter.HighResolution)
printer.setOutputFormat(QPrinter.PdfFormat)
printer.setOrientation(getattr(QPrinter, "Portrait"))
printer.setOutputFileName(self.path)
printer.setPaperSize(getattr(QPrinter, self.paper))
printer.setFullPage(True)
guide = self.max_cards()
printer.setOrientation(getattr(QPrinter, guide["orientation"]))
print guide, self.card_size
#Start printing
with QPainter(printer) as paint:
ind = 0
resol = printer.resolution()
for c in self.deck:
c.resize(self.card_size[0], self.card_size[1])
if ind == guide["max"]:
printer.newPage()
ind = 0
col = ind % guide["horizontal"]
fil = ind // guide["horizontal"]
print ind, fil, col
target = QRectF((col)*self.card_size[0]*resol, (fil)*self.card_size[1]*resol,
self.card_size[0]*resol, self.card_size[1]*resol)
self.preview_card(c)
self.scene.render(paint, target=target, source=QRectF(0,0,c.width(),c.height()))
ind += 1
示例2: plotSVG
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import resolution [as 别名]
def plotSVG(self, width, height, output_file, _plotting_object = None):
"""Plots the data specified in the current input file as a page in a
PDF file with the given width and height, writing the output to the
specified output file. Returns the SVG object produced."""
printer = QPrinter()
svg = QSvgGenerator()
svg.setFileName(output_file)
svg.setSize(QSize(width, height))
svg.setViewBox(QRect(0, 0, width, height))
svg.setResolution(printer.resolution())
return self._plot(width, height, svg, _plotting_object)[0]