Merge pull request #648 from VanessaNav/fix-color-GLGridItem
fix color ignored in GLGridItem. Issue #283 solved
This commit is contained in:
commit
980fffbd31
@ -13,7 +13,7 @@ class GLGridItem(GLGraphicsItem):
|
||||
Displays a wire-frame grid.
|
||||
"""
|
||||
|
||||
def __init__(self, size=None, color=None, antialias=True, glOptions='translucent'):
|
||||
def __init__(self, size=None, color=(1, 1, 1, .3), antialias=True, glOptions='translucent'):
|
||||
GLGraphicsItem.__init__(self)
|
||||
self.setGLOptions(glOptions)
|
||||
self.antialias = antialias
|
||||
@ -21,6 +21,7 @@ class GLGridItem(GLGraphicsItem):
|
||||
size = QtGui.QVector3D(20,20,1)
|
||||
self.setSize(size=size)
|
||||
self.setSpacing(1, 1, 1)
|
||||
self.color = color
|
||||
|
||||
def setSize(self, x=None, y=None, z=None, size=None):
|
||||
"""
|
||||
@ -66,8 +67,8 @@ class GLGridItem(GLGraphicsItem):
|
||||
x,y,z = self.size()
|
||||
xs,ys,zs = self.spacing()
|
||||
xvals = np.arange(-x/2., x/2. + xs*0.001, xs)
|
||||
yvals = np.arange(-y/2., y/2. + ys*0.001, ys)
|
||||
glColor4f(1, 1, 1, .3)
|
||||
yvals = np.arange(-y/2., y/2. + ys*0.001, ys)
|
||||
glColor4f(*self.color)
|
||||
for x in xvals:
|
||||
glVertex3f(x, yvals[0], 0)
|
||||
glVertex3f(x, yvals[-1], 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user