代码拉取完成,页面将自动刷新
import pyqtgraph as pg
from pyqtgraph import functions as fn
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.graphicsItems.ROI import MouseDragHandler
import pyqtgraph.opengl as gl
import numpy as np
import pynput
import time
from datetime import datetime
import pyqtgraph.console
from mpl_toolkits.mplot3d import axes3d
import matplotlib as plt
from OpenGL.GL import *
from pyqtgraph.opengl.GLGraphicsItem import GLGraphicsItem
from pyqtgraph import QtGui
app = pg.mkQApp("GLScatterPlotItem Example")
w = gl.GLViewWidget()
w.opts['distance'] = 20
w.show()
w.setWindowTitle('pyqtgraph example: GLScatterPlotItem')
g = gl.GLGridItem()
w.addItem(g)
'''
for i in range label:
if label==num[i]:
def update(x,y,z):
## update surface positions and colors
global velocity, sp3, distance
velocity -= 0.1
#track equation
x = -np.cos(distance*3+velocity)
y = -np.sin(distance*4+velocity)
z = -np.cos(distance*2+velocity)
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*3+velocity
pos[:,0] = x
pos[:,1] = y
pos[:,2] = z
sp3.setData(pos=pos), #color=color)
t = QtCore.QTimer()
t.timeout.connect(update)
t.start(50)
else:
def update():
## update surface positions and colors
global velocity, sp3, distance
velocity -= 0.1
#track equation
x = -np.cos(distance*3+velocity)
y = -np.sin(distance*4+velocity)
z = -np.cos(distance*2+velocity)
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*3+velocity
pos[:,0] = x
pos[:,1] = y
pos[:,2] = z
sp3.setData(pos=pos), #color=color)
t = QtCore.QTimer()
t.timeout.connect(update)
t.start(50)
'''
velocity = 0.
pos = np.empty((53, 3))
size = np.empty((53))
pos[0] = [1, 0, 0]; size[0] = 0.25;
pos[1] = [0, 1, 0]; size[1] = 0.25;
pos[2] = [0, 0, 1]; size[2] = 0.25;
pos[3] = [1, 1, 0]; size[3] = 0.25;
pos[4] = [1, 0, 1]; size[4] = 0.25;
pos[5] = [0, 1, 1]; size[5] = 0.25;
pos[6] = [1, 1, 1]; size[6] = 0.25;
pos[7] = [0, 0, 0]; size[7] = 0.25;
distance = (pos**2).sum(axis=1)**0.5
''''''
sp3 = gl.GLScatterPlotItem(pos=pos, color=(1,1,1,.3), size=0.1, pxMode=False)
w.addItem(sp3)
#raise brightness
w.addItem(sp3)
def update():
## update surface positions and colors
global velocity, sp3, distance
velocity -= 0.1
#track equation
x = -np.cos(distance*3+velocity)
y = -np.sin(distance*4+velocity)
z = -np.cos(distance*2+velocity)
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*2+velocity
#z = d3*3+velocity
pos[:,0] = x
pos[:,1] = y
pos[:,2] = z
'''
color = np.empty((len(d3),4), dtype=np.float32)
color[:,3] = 0.3
color[:,0] = np.clip(z * 3.0, 0, 1)
color[:,1] = np.clip(z * 1.0, 0, 1)
color[:,2] = np.clip(z ** 3, 0, 1)
'''
sp3.setData(pos=pos), #color=color)
t = QtCore.QTimer()
t.timeout.connect(update)
t.start(50)
#with pynput.mouse.Events() as event:
# for i in event:
# if isinstance(i,pynput.mouse.Events.Click):
# print()
#console
'''
app = pg.mkQApp()
namespace = {'pg': pg, 'np': np}
text = """An interactive python console has successfully runned. Please input your order."""
c = pyqtgraph.console.ConsoleWidget(namespace=namespace, text=text)
c.show()
c.setWindowTitle('pyqtgraph example: ConsoleWidget')
'''
if __name__ == '__main__':
pg.exec()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。