Skip to content
Snippets Groups Projects
Commit 0c98fc78 authored by Garrett Bates's avatar Garrett Bates
Browse files

Added test for pyqtgraph; added .gitignore

parents
No related branches found
No related tags found
No related merge requests found
__pycache__/
import sys
import random
from PySide2 import QtCore, QtGui, QtWidgets
import pyqtgraph
class TestWidget(QtWidgets.QWidget):
def __init__(self, other=None):
super().__init__()
self.plot = pyqtgraph.PlotWidget()
# Disable zooming on the y-axes.
self.plot.setMouseEnabled(y=False)
if other:
# setXLink will link the x-axes of the two plot widgets
# There is a corresponding function setYLink if we ever
# need to do the same for the y-axes, though for now it does
# not seem like something we would need.
self.plot.setXLink(other.plot)
self.layout = QtWidgets.QGridLayout()
self.layout.addWidget(self.plot, 0, 0, 1, 1)
self.setLayout(self.layout)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
w = TestWidget()
w.resize(800, 600)
w.show()
# Plot will take in a list, or a numpy array type
# May generalize to other iterable types.
w.plot.plot([0, 1, 2, 1, 2, 3, 0])
w2 = TestWidget(w)
w2.resize(800, 600)
w2.move(500, 500)
w2.show()
# Plot will not take in iterators, though. So need
# to cast this.
w2.plot.plot(list(reversed([0, 1, 2, 1, 2, 3, 0])))
app.exec_()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment