CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
GLGraphItem.py56 linesDownload Raw Back to examples
1"""2Demonstrates use of GLGraphItem3"""4 5import sys6 7import numpy as np8 9import pyqtgraph as pg10from pyqtgraph.Qt import QtGui11import pyqtgraph.opengl as gl12 13if 'darwin' in sys.platform:14    fmt = QtGui.QSurfaceFormat()15    fmt.setRenderableType(fmt.RenderableType.OpenGL)16    fmt.setProfile(fmt.OpenGLContextProfile.CoreProfile)17    fmt.setVersion(4, 1)18    QtGui.QSurfaceFormat.setDefaultFormat(fmt)19 20app = pg.mkQApp("GLGraphItem Example")21w = gl.GLViewWidget()22w.setCameraPosition(distance=5)23w.show()24 25edges = np.array([26    [0, 2],27    [0, 3],28    [1, 2],29    [1, 3],30    [2, 3]31])32 33nodes = np.array(34    [35        [0, 0, 0],36        [1, 0, 0],37        [0, 1, 0],38        [1, 1, 1]39    ]40)41 42edgeColor=pg.glColor("w")43 44gi = gl.GLGraphItem(45    edges=edges,46    nodePositions=nodes,47    edgeWidth=1.,48    nodeSize=0.1,49    pxMode=False50)51 52w.addItem(gi)53 54if __name__ == "__main__":55    pg.exec()56 
Aluode/PerceptionLabPortable · CoolFace