本文整理汇总了Python中PyQt4.QtGui.QPrinter.width方法的典型用法代码示例。如果您正苦于以下问题:Python QPrinter.width方法的具体用法?Python QPrinter.width怎么用?Python QPrinter.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QPrinter
的用法示例。
在下文中一共展示了QPrinter.width方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Ui_py_de
# 需要导入模块: from PyQt4.QtGui import QPrinter [as 别名]
# 或者: from PyQt4.QtGui.QPrinter import width [as 别名]
class Ui_py_de(object):
def setupUi(self, py_de):
self.printer = QPrinter()
self.imagesDir = "images/"
####################################
## Set up our initial window object
####################################
py_de.setObjectName("py_de")
py_de.resize(QtCore.QSize(QtCore.QRect(0, 0, 800, 570).size()).expandedTo(py_de.minimumSizeHint()))
self.centralwidget = QtGui.QTabWidget(py_de)
self.centralwidget.setObjectName("centralwidget")
self.centralwidget.setGeometry(QtCore.QRect(50,50,200,200))
####################################
## Set up tabs
####################################
self.tab = QtGui.QWidget()
self.tab.setObjectName("tab")
self.tablayout = QtGui.QGridLayout(self.tab)
####################################
## The actual text box.
####################################
self.textEdit = QsciScintilla(self.tab)
#####################################
### Set the syntax highlighting.
#####################################
## define the font to use
self.font = QtGui.QFont()
self.font.setFamily("Consolas")
self.font.setFixedPitch(True)
self.font.setPointSize(10)
# the font metrics here will help
# building the margin width later
self.fm = QtGui.QFontMetrics(self.font)
## set the default font of the editor
## and take the same font for line numbers
self.textEdit.setFont(self.font)
self.textEdit.setMarginsFont(self.font)
## Line numbers
# conventionaly, margin 0 is for line numbers
self.textEdit.setMarginWidth(0, self.fm.width( "00000" ) + 5)
self.textEdit.setMarginLineNumbers(0, True)
## Edge Mode shows a red vertical bar at 80 chars
self.textEdit.setEdgeMode(QsciScintilla.EdgeLine)
self.textEdit.setEdgeColumn(80)
self.textEdit.setEdgeColor(QtGui.QColor("#FF0000"))
## Folding visual : we will use boxes
self.textEdit.setFolding(QsciScintilla.BoxedTreeFoldStyle)
## Braces matching
self.textEdit.setBraceMatching(QsciScintilla.SloppyBraceMatch)
## Editing line color
self.textEdit.setCaretLineVisible(True)
self.textEdit.setCaretLineBackgroundColor(QtGui.QColor("#CDA869"))
## Margins colors
# line numbers margin
self.textEdit.setMarginsBackgroundColor(QtGui.QColor("#333333"))
self.textEdit.setMarginsForegroundColor(QtGui.QColor("#CCCCCC"))
# folding margin colors (foreground,background)
self.textEdit.setFoldMarginColors(QtGui.QColor("#99CC66"),QtGui.QColor("#333300"))
## Choose a lexer
lexer = QsciLexerPython()
lexer.setDefaultFont(self.font)
self.textEdit.setLexer(lexer)
## Render on screen
self.textEdit.show()
## Show this file in the self.textEdit
#####################################
## end of syntax highlighting.
#####################################
####################################
## Set up the sizes of everything
####################################
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Policy(1),QtGui.QSizePolicy.Policy(1))
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.textEdit.sizePolicy().hasHeightForWidth())
#.........这里部分代码省略.........