GridItem: Add custom line width based on pen option.
This commit is contained in:
parent
5a08650853
commit
0e7b8a4828
@ -1,5 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
## Add path to library (just for examples; you do not need this)
|
||||
from PySide2.QtGui import QPen, QColor
|
||||
|
||||
import initExample
|
||||
|
||||
from pyqtgraph.Qt import QtCore, QtGui
|
||||
@ -56,6 +58,9 @@ prox.setPos(100,0)
|
||||
vb.addItem(prox)
|
||||
|
||||
g = pg.GridItem()
|
||||
p = QPen(QColor(0, 255, 255))
|
||||
p.setWidthF(1)
|
||||
g.opts["pen"] = p
|
||||
vb.addItem(g)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -157,6 +157,7 @@ class GridItem(UIGraphicsItem):
|
||||
|
||||
linePen = self.opts['pen']
|
||||
lineColor = self.opts['pen'].color()
|
||||
lineWidth = self.opts['pen'].width()
|
||||
lineColor.setAlpha(c)
|
||||
linePen.setColor(lineColor)
|
||||
|
||||
@ -170,9 +171,9 @@ class GridItem(UIGraphicsItem):
|
||||
for x in range(0, int(nl[ax])):
|
||||
linePen.setCosmetic(False)
|
||||
if ax == 0:
|
||||
linePen.setWidthF(self.pixelWidth())
|
||||
linePen.setWidthF(lineWidth * self.pixelWidth())
|
||||
else:
|
||||
linePen.setWidthF(self.pixelHeight())
|
||||
linePen.setWidthF(lineWidth * self.pixelHeight())
|
||||
p.setPen(linePen)
|
||||
p1 = np.array([0.,0.])
|
||||
p2 = np.array([0.,0.])
|
||||
|
Loading…
Reference in New Issue
Block a user