当前位置: 首页>>代码示例>>Python>>正文


Python QPrinter.resolution方法代码示例

本文整理汇总了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
开发者ID:Ja-vi,项目名称:pnp,代码行数:33,代码来源:printer.py

示例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]
开发者ID:metno,项目名称:python-diana,代码行数:15,代码来源:bdiana.py


注:本文中的PyQt4.QtGui.QPrinter.resolution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。