本文整理汇总了Python中PyQt5.QtGui.QPen方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPen方法的具体用法?Python QtGui.QPen怎么用?Python QtGui.QPen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QPen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _write_instruction2
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def _write_instruction2(self, asm, qp, cemu):
s = asm.operands
idx = 0
qp.setPen(QtGui.QPen(QtGui.QColor(192, 192, 192), 1, QtCore.Qt.SolidLine))
for tok in asm.lexer:
if tok.lexpos > idx:
cemu.write(s[idx:tok.lexpos])
idx = tok.lexpos
qp.save()
if tok.type == 'REGISTER':
qp.setPen(QtGui.QPen(QtGui.QColor('white')))
if tok.type == 'NUMBER':
qp.setPen(QtGui.QPen(QtGui.QColor('green')))
cemu.write(tok.value)
qp.restore()
idx = tok.lexpos + len(tok.value)
if idx < len(s):
cemu.write(s[idx:])
示例2: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self, themes, dataModel, viewMode):
self.width = 0
self.height = 0
self.dataModel = dataModel
self.viewMode = viewMode
self.qpix = self._getNewPixmap(self.width, self.height)
self.backgroundBrush = QtGui.QBrush(themes['background'])
# text font
self.font = themes['font']
# font metrics. assume font is monospaced
self.font.setKerning(False)
self.font.setFixedPitch(True)
fm = QtGui.QFontMetrics(self.font)
self.fontWidth = fm.width('a')
self.fontHeight = fm.height()
self.textPen = QtGui.QPen(QtGui.QColor(192, 192, 192), 0, QtCore.Qt.SolidLine)
示例3: handleEditMode
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def handleEditMode(self, modifiers, key, event):
if key in range(0, 256):
offs = self.getCursorOffsetInPage()
self.dataModel.setData_b(self.dataModel.getOffset() + offs, str(event.text()))
z = self.dataModel.getOffset() + offs
# TODO: sa nu se repete, tre original_transformengine
self.transformationEngine = RangePen(self.original_textdecorator, z, z + 0,
QtGui.QPen(QtGui.QColor(218, 94, 242), 0, QtCore.Qt.SolidLine),
ignoreHighlights=True)
self.moveCursor(Directions.Right)
x, y = self.cursor.getPosition()
self.draw(refresh=True, row=y, howMany=1)
示例4: paintEvent
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def paintEvent(self, event):
painter = QPainter()
painter.begin(self)
painter.setRenderHint(QPainter.Antialiasing)
painter.fillRect(event.rect(), QBrush(QColor(255, 255, 255, 200)))
painter.setPen(QPen(Qt.NoPen))
if self.lists is not None:
path = os.path.abspath(os.path.dirname(__file__)) + '/static/'
path += self.lists[self.list_index] + '.png'
self.list_index += 1
if self.list_index >= len(self.lists):
self.list_index = 0
image = QImage(path)
rect_image = image.rect()
rect_painter = event.rect()
dx = (rect_painter.width() - rect_image.width()) / 2.0
dy = (rect_painter.height() - rect_image.height()) / 2.0
painter.drawImage(dx, dy, image)
painter.end()
示例5: highligting
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def highligting(self, color, underline_width):
color = QColor(color)
color = QColor(color.red(), color.green(), color.blue(), 200)
painter = QPainter(self)
if config.hover_underline:
font_metrics = QFontMetrics(self.font())
text_width = font_metrics.width(self.word)
text_height = font_metrics.height()
brush = QBrush(color)
pen = QPen(brush, underline_width, Qt.SolidLine, Qt.RoundCap)
painter.setPen(pen)
if not self.skip:
painter.drawLine(0, text_height - underline_width, text_width, text_height - underline_width)
if config.hover_hightlight:
x = y = 0
y += self.fontMetrics().ascent()
painter.setPen(color)
painter.drawText(x, y + config.outline_top_padding - config.outline_bottom_padding, self.word)
示例6: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = myScene(0, 0, 561, 581)
self.scene.win = self
self.view.setScene(self.scene)
self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
self.image.fill(col_zero)
self.lock.clicked.connect(lambda: lock(self))
self.erase.clicked.connect(lambda: clean_all(self))
self.paint.clicked.connect(lambda: fill_with_seed(self))
self.addpoint.clicked.connect(lambda: add_point_by_btn(self))
self.pixel.clicked.connect(lambda: set_flag_zat(self))
self.addcircle.clicked.connect(lambda: set_flag_cir(self))
self.edges = []
self.point_now = None
self.point_lock = None
self.pen = QPen(col_one)
self.delay.setChecked(False)
示例7: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = Scene(0, 0, 561, 581)
self.scene.win = self
self.view.setScene(self.scene)
self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
self.image.fill(Qt.white)
self.bars.clicked.connect(lambda : set_bars(self))
self.erase.clicked.connect(lambda: clean_all(self))
self.paint.clicked.connect(lambda: clipping(self))
self.rect.clicked.connect(lambda: set_rect(self))
self.ect.clicked.connect(lambda: add_bars(self))
self.lines = []
self.clip = None
self.point_now = None
self.input_bars = False
self.input_rect = False
self.pen = QPen(red)
示例8: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = myScene(0, 0, 561, 581)
self.scene.win = self
self.view.setScene(self.scene)
self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
self.image.fill(col_zero)
self.lock.clicked.connect(lambda: lock(self))
self.erase.clicked.connect(lambda: clean_all(self))
self.paint.clicked.connect(lambda: fill_xor(self))
self.addpoint.clicked.connect(lambda: add_point_by_btn(self))
self.edges = []
self.point_now = None
self.point_lock = None
self.pen = QPen(col_one)
self.delay.setChecked(False)
示例9: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = Scene(0, 0, 561, 581)
self.scene.win = self
self.view.setScene(self.scene)
self.image = QImage(561, 581, QImage.Format_ARGB32_Premultiplied)
self.image.fill(Qt.white)
self.bars.clicked.connect(lambda : set_bars(self))
self.erase.clicked.connect(lambda: clean_all(self))
self.paint.clicked.connect(lambda: clipping(self))
self.rect.clicked.connect(lambda: set_rect(self))
self.ect.clicked.connect(lambda: add_bars(self))
self.lock.clicked.connect(lambda: lock(self))
self.lines = []
self.edges = []
self.clip = None
self.point_now_rect = None
self.point_now_bars = None
self.point_lock = None
self.input_bars = False
self.input_rect = False
self.pen = QPen(black)
示例10: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self):
QtWidgets.QWidget.__init__(self)
uic.loadUi("window.ui", self)
self.scene = QtWidgets.QGraphicsScene(0, 0, 511, 511)
self.mainview.setScene(self.scene)
self.image = QImage(511, 511, QImage.Format_ARGB32_Premultiplied)
self.pen = QPen()
self.color_line = QColor(Qt.black)
self.color_bground = QColor(Qt.white)
self.draw_once.clicked.connect(lambda: draw_once(self))
self.clean_all.clicked.connect(lambda: clear_all(self))
self.btn_bground.clicked.connect(lambda: get_color_bground(self))
self.btn_line.clicked.connect(lambda: get_color_line(self))
self.draw_centr.clicked.connect(lambda: draw_centr(self))
layout = QtWidgets.QHBoxLayout()
layout.addWidget(self.what)
layout.addWidget(self.other)
self.setLayout(layout)
self.circle.setChecked(True)
self.canon.setChecked(True)
#self.circle.toggled.connect(lambda : change_text(self))
示例11: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self, viewmode):
self.operations = []
self.dataModel = viewmode.getDataModel()
self.viewmode = viewmode
self.penMap = {}
self.brushMap = {}
self.PenInterval = []
self.normalPen = QtGui.QPen(QtGui.QColor(192, 192, 192), 1, QtCore.Qt.SolidLine)
# if we want to generate T/F table
self.Special = string.ascii_letters + string.digits + ' .;\':;=\"?-!()/\\_'
self.Special = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, True, True, True, False, False, False, False, True, True,
True, False, False, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, False, True, False, True,
False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True,
True, True, True, False, True, False, False, True, False, True, True, True, True, True, True, True, True, True, True, True, True, True, True, True,
True, True, True, True, True, True, True, True, True, True, True, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
示例12: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self, dataModel, viewMode):
self.width = 0
self.height = 0
self.dataModel = dataModel
self.viewMode = viewMode
self.qpix = self._getNewPixmap(self.width, self.height)
self.backgroundBrush = QtGui.QBrush(QtGui.QColor(0, 0, 128))
# text font
self.font = QtGui.QFont('Terminus', 11, QtGui.QFont.Light)
# font metrics. assume font is monospaced
self.font.setKerning(False)
self.font.setFixedPitch(True)
fm = QtGui.QFontMetrics(self.font)
self.fontWidth = fm.width('a')
self.fontHeight = fm.height()
self.textPen = QtGui.QPen(QtGui.QColor(192, 192, 192), 0, QtCore.Qt.SolidLine)
示例13: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def __init__(self, dataModel, viewMode, elfplugin):
self.width = 0
self.height = 0
self.dataModel = dataModel
self.viewMode = viewMode
self.qpix = self._getNewPixmap(self.width, self.height)
self.backgroundBrush = QtGui.QBrush(QtGui.QColor(0, 0, 128))
self.elfplugin = elfplugin
self.elf = self.elfplugin.elf
# text font
self.font = QtGui.QFont('Terminus', 11, QtGui.QFont.Bold)
# font metrics. assume font is monospaced
self.font.setKerning(False)
self.font.setFixedPitch(True)
fm = QtGui.QFontMetrics(self.font)
self.fontWidth = fm.width('a')
self.fontHeight = fm.height()
self.textPen = QtGui.QPen(QtGui.QColor(192, 192, 192), 0, QtCore.Qt.SolidLine)
示例14: init
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def init(self, viewMode, parent):
self.viewMode = viewMode
self.MZbrush = QtGui.QBrush(QtGui.QColor(128, 0, 0))
self.greenPen = QtGui.QPen(QtGui.QColor(255, 255, 0))
self.textDecorator = TextDecorator(viewMode)
self.textDecorator = HighlightASCII(self.textDecorator)
self.textDecorator = HighlightPrefix(self.textDecorator, '\x55\xAA', brush=self.MZbrush, pen=self.greenPen)
self.viewMode.setTransformationEngine(self.textDecorator)
self.viewMode.selector.addSelection((446, 446+1*16, QtGui.QBrush(QtGui.QColor(125, 75, 150)), 0.8), type=TextSelection.SelectionType.PERMANENT)
self.viewMode.selector.addSelection((446+16, 446+2*16, QtGui.QBrush(QtGui.QColor(55, 125, 50)), 0.8), type=TextSelection.SelectionType.PERMANENT)
self.viewMode.selector.addSelection((446+2*16, 446+3*16, QtGui.QBrush(QtGui.QColor(125, 75, 150)), 0.8), type=TextSelection.SelectionType.PERMANENT)
self.viewMode.selector.addSelection((446+3*16, 446+4*16, QtGui.QBrush(QtGui.QColor(55, 125, 50)), 0.8), type=TextSelection.SelectionType.PERMANENT)
return True
示例15: init
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QPen [as 别名]
def init(self, viewMode, parent):
self._viewMode = viewMode
self.MZbrush = QtGui.QBrush(QtGui.QColor(128, 0, 0))
self.greenPen = QtGui.QPen(QtGui.QColor(255, 255, 0))
self.grayBrush = QtGui.QBrush(QtGui.QColor(128, 128, 128))
self.whitePen = QtGui.QPen(QtGui.QColor(255, 255, 255))
self.textDecorator = TextDecorator(viewMode)
self.textDecorator = HighlightASCII(self.textDecorator)
self.textDecorator = HighlightPrefix(self.textDecorator, 'MZ', brush=self.MZbrush, pen=self.greenPen)
self.textDecorator = HighlightPrefix(self.textDecorator, 'PE\x00\x00', brush=self.MZbrush, pen=self.greenPen)
self.textDecorator = HighlightPrefix(self.textDecorator, '\xFF\x15', additionalLength=4, brush=self.grayBrush, pen=self.whitePen)
self.textDecorator = HighlightWideChar(self.textDecorator)
self._viewMode.setTransformationEngine(self.textDecorator)
return True