本文整理汇总了Python中pyqtgraph.setConfigOption函数的典型用法代码示例。如果您正苦于以下问题:Python setConfigOption函数的具体用法?Python setConfigOption怎么用?Python setConfigOption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setConfigOption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
QtGui.QMainWindow.__init__(self) # These three commands
Ui_MainWindow.__init__(self) # are needed to
pg.setConfigOption('background', 'w') # sets graph background to white
pg.setConfigOption('foreground', 'k') # sets axis color to black
self.setupUi(self) # to setup the ui
# La logica di programmare una interfaccia mi sembra la seguente:
# per prima cosa inizializzo l'interfaccia grafica
# dopo aver inizializzato l'interfaccia
# (che modifico e organizzo tramite Qt Creator)
# associo ad ogni azione che eseguo sulla interfaccia
# un metodo della classe che definisco a seguito
self.btnStart.clicked.connect(self.Start)
self.timer = QtCore.QTimer(self) # qui richiamo l'oggetto timer delle libreria QT
self.timer.timeout.connect(self.UpdateView) # e gli dico che quando il timer va in timeout devo fare l'update dells visuale
# le istruzioni seguenti servono a disabilitare il mouse su tutti
# i possobili plot dell'interfaccia
self.pltMonitor.setMouseEnabled(x=False,y=False)
self.pltAlign.setMouseEnabled(x=False,y=False)
self.pltDelay.setMouseEnabled(x=False,y=False)
self.NumCh = 8
self.inAcq = False # flag di acquisizione in corso o meno
self.getParameters()
示例2: __init__
def __init__(self, name="Demo", icon="cwicon"):
super(MainChip, self).__init__()
self.manageTraces = TraceManagerDialog(self)
# self.manageTraces.tracesChanged.
self.name = name
self.filename = None
self.dirty = True
self.projEditWidget = ProjectTextEditor(self)
self.projectChanged.connect(self.projEditWidget.setProject)
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
self.lastMenuActionSection = None
self.initUI(icon)
self.paramTrees = []
self.originalStdout = None
#Fake widget for dock
#TODO: Would be nice if this auto-resized to keep small, but not amount of playing
#with size policy or min/max sizes has worked.
fake = QWidget()
self.setCentralWidget(fake)
self.paramScripting = self.addConsole("Script Commands", visible=False)
self.addPythonConsole()
示例3: __init__
def __init__(self, xtitle, ytitle,*args):
super(QBPlot, self).__init__(*args)
self.setupUi(self)
self.x_axis_title = xtitle
self.y_axis_title = ytitle
pg.setConfigOption('background', (226, 226, 226))
pg.setConfigOption('foreground', 'k')
示例4: figure
def figure(title = None, background='w'):
if background == 'w':
pg.setConfigOption('background', 'w') # set background to white
pg.setConfigOption('foreground', 'k')
pg.mkQApp()
win = pg.GraphicsWindow(title=title)
return win
示例5: __init__
def __init__(self, versionNo):
print("PyVNA __init__()")
self.version = versionNo
pyqtgraph.setConfigOption('background', 'w')
pyqtgraph.setConfigOption('foreground', 'k')
self.vna_idx = 1
super(PyVNA, self).__init__()
icopath = "./Akela Logo.ico"
# Icon isn't on current path, and we're running in a frozen context,
# so therefore look for the icon at the frozen location.
if not os.path.exists(icopath) and getattr(sys, 'frozen', False):
icopath = os.path.join(sys._MEIPASS, icopath)
icon = QIcon(icopath)
self.setWindowIcon(icon)
self.vnas = []
self.initUI()
self.setWindowTitle("OpenVNA Python Example Program")
示例6: __init__
def __init__(self, args):
self.args = args
#QtGui.QApplication.setGraphicsSystem('raster')
app = QtGui.QApplication([])
#mw = QtGui.QMainWindow()
#mw.resize(800,800)
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
win = pg.GraphicsWindow(title="Basic plotting examples")
win.resize(1000,600)
win.setWindowTitle('plot')
# Enable antialiasing for prettier plots
pg.setConfigOptions(antialias=True)
self.order_book_plot = OrderBookPlot(self.args, win)
if self.args.enable_sample_mode:
timer = QtCore.QTimer()
timer.timeout.connect(self.update_sample)
timer.start(500)
else:
thread = RabbitMQThread(self.args)
thread.newData.connect(self.order_book_plot.update)
thread.start()
import sys
## Start Qt event loop unless running in interactive mode or using pyside.
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
示例7: plot
def plot(self, Rs=None, Vg=0):
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
# Generate plot
plt = pg.plot(title=self.__class__.__name__, clear=True)
plt.setYRange(0, self.IDSS_MAX)
plt.setXRange(self.VP_MAX, 0)
plt.showGrid(True, True, 1.0)
plt.setLabel('left', "Id (mA)")
plt.setLabel('bottom', "Vgs (V)")
(x, y) = self.id_max_points()
plt.plot(x, y, pen=pg.mkPen('g', width=3))
(x, y) = self.id_min_points()
plt.plot(x, y, pen=pg.mkPen('b', width=3))
if Rs is not None:
(x, y) = self.vg_intercept(Rs, Vg)
plt.plot(x, y, pen=pg.mkPen('r', width=3))
# Display plot
QtGui.QApplication.instance().exec_()
pg.exit()
示例8: __init__
def __init__(self, stream, buf_size, col="w", chnames=False, invert=False):
""" Initializes the grapher.
Args:
stream: <pylsl.StreamInfo instance> pointer to a stream
buf_size: <integer> visualization buffer length in samples
col: <char> color of the line plot (b,r,g,c,m,y,k and w)
"""
self.stream = stream
self.inlet = pylsl.StreamInlet(stream)
self.buf_size = buf_size
self.channel_count = self.inlet.channel_count
self.gbuffer = np.zeros(self.buf_size * self.channel_count)
self.gtimes = np.zeros(self.buf_size) + pylsl.local_clock()
self.col = col
if chnames:
if self.channel_count == len(chnames):
self.chnames = chnames
else:
print("Channel names vs channel count mismatch, skipping")
else:
self.chnames = False
if invert:
pg.setConfigOption("background", "w")
pg.setConfigOption("foreground", "k")
self.fill_buffer()
self.start_graph()
示例9: __init__
def __init__(self,filename,env,parent=None):
super(correlateAttributes,self).__init__(parent)
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
self.fileName=filename
self.setWindowTitle("Correlate attributes")
self.resize(1000,1000)
self.env=env
self.attr1=QtGui.QLineEdit()
self.attr2=QtGui.QLineEdit()
formbox=QtGui.QFormLayout()
formbox.addRow('Name of attribute 1 : ',self.attr1)
formbox.addRow('Name of attribute 2 : ',self.attr2)
form=QtGui.QFrame()
form.setLayout(formbox)
self.p1=pg.PlotWidget()
button1=QtGui.QPushButton('Calculate correlation')
button1.clicked.connect(self.calculate)
vbox1=QtGui.QVBoxLayout()
vbox1.addStretch(1)
vbox1.addWidget(form)
vbox1.addWidget(button1)
vbox1.addWidget(self.p1)
self.setLayout(vbox1)
self.show()
示例10: __init__
def __init__(self, plot_params):
pg.setConfigOption('background', 'w')
self.pw = pg.PlotWidget(pen=pg.mkPen('b', width=4))
self.pw.setYRange(-0.4,0.4)
self.pw.disableAutoRange(ViewBox.ViewBox.YAxis)
self.pw.hideButtons()
self.bar_color = (100,100,255)
self.data = {}# All of the data points ever received
self.plot_data = {}# The datapoints that are shown on the screen
self.plots = {}
self.lines = set()
self.listeners = []
plot_params.setdefault("type", "bar")
if plot_params['type'] == "bar":
self.bar = True
self.bar_buffer = {} # A buffer that holds datapoints until they are averaged into bars
self.dp_counter = {} # The number of datapoints in the buffer so far
if 'bar_width' in plot_params:
self.bar_width = int(plot_params['bar_width'])
else:
self.bar_width = 15
else:
self.bar = False
print "'", plot_params['signals'], "'"
for sig in plot_params['signals'].split(","):
signal_name = self.read_signal(sig)
self.lines = self.lines.union(signal_name)
示例11: __init__
def __init__(self):
QtGui.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
pg.setConfigOption('background', 'w') # sets background to white
pg.setConfigOption('foreground', 'k') # sets axis color to black
self.setupUi(self)
self.btnStart.clicked.connect(self.Start)
self.tabWidget.currentChanged.connect(self.SetupView)
self.timer = QtCore.QTimer(self)
self.timer.timeout.connect(self.UpdateView)
self.curTab = self.tabWidget.currentIndex()
self.SetupView(self.curTab)
self.pltMonitor.setMouseEnabled(x=False,y=False)
self.pltAlign.setMouseEnabled(x=False,y=False)
self.pltDelay.setMouseEnabled(x=False,y=False)
self.pltSingle.setMouseEnabled(x=False,y=False)
self.pltCoinc.setMouseEnabled(x=False,y=False)
self.pltSingleVis.setMouseEnabled(x=False,y=False)
self.pltCoincVis.setMouseEnabled(x=False,y=False)
self.inAcq = False
self.getParameters()
示例12: set_pg_colors
def set_pg_colors(form):
'''Set default BG and FG color for pyqtgraph plots.'''
bgColorRGBA = form.palette().color(QtGui.QPalette.ColorRole.Window)
fgColorRGBA = form.palette().color(QtGui.QPalette.ColorRole.WindowText)
pg.setConfigOption('background', bgColorRGBA)
pg.setConfigOption('foreground', fgColorRGBA)
pg.setConfigOptions(antialias=True) ## this will be expensive for the local plot
示例13: __init__
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
pg.setConfigOptions(antialias=False)
self.scopeWidget = pg.PlotWidget()
self.scopeWidget.setTitle('Scope trace', size='12')
self.vbl = QtGui.QVBoxLayout()
self.vbl.addWidget(self.scopeWidget)
self.setLayout(self.vbl)
self.scopeWidget.setLabel('left', 'Signal', units='V')
self.scopeWidget.setLabel('bottom', 'Time', units='s')
self.scopeWidget.showGrid(x=False, y=True)
self.scopeWidget.clear()
self.lr1 = pg.LinearRegionItem([0,0], brush=pg.mkBrush(0,0,160,80))
self.lr2 = pg.LinearRegionItem([0,0], brush=pg.mkBrush(52,124,23,80))
self.lr1.setZValue(10)
self.lr2.setZValue(10)
self.scopeWidget.addItem(self.lr2)
self.scopeWidget.addItem(self.lr1)
self.lr1.setMovable(False)
self.lr2.setMovable(False)
示例14: __init__
def __init__(self):
QtGui.QWidget.__init__(self)
subpanel.__init__(self)
#pg.setConfigOption('background', (255,255,255))
pg.setConfigOption('foreground', (128,128,128))
self.ui = Ui_plotWindow()
self.ui.setupUi(self)
self.ui.graphicsView.hideAxis('bottom')
self.ui.graphicsView.getAxis('top').setHeight(10)
self.ui.graphicsView.getAxis('bottom').setHeight(10)
self.ui.graphicsView.getAxis('left').setWidth(50)
self.ui.graphicsView.setBackground((255,255,255))
#brush = QtGui.QBrush()
#self.ui.graphicsView.setForegroundBrush(brush.color(QtGui.QColor('grey')))
self.plotCount = 0
self.legend = None
self.colors = [QtGui.QColor('blue'),
QtGui.QColor('red'),
QtGui.QColor('lime'),
QtGui.QColor('cornflowerblue'),
QtGui.QColor('greenyellow'),
QtGui.QColor('violet'),
QtGui.QColor('orange'),
QtGui.QColor('deepskyblue'),
QtGui.QColor('firebrick'),
QtGui.QColor('aqua')]
示例15: setupGUI
def setupGUI(self):
self.setWindowTitle("Calculator plot")
self.setGeometry(80, 50, 800, 600)
self.setWindowIcon(QtGui.QIcon('../images/Logo.png'))
pg.setConfigOption('background', (255,255,255))
pg.setConfigOption('foreground',(0,0,0))
self.layout = QtGui.QVBoxLayout()
self.layout.setContentsMargins(0,0,0,0)
self.layout.setSpacing(0)
self.setLayout(self.layout)
# split window into two halfs
self.splitter = QtGui.QSplitter()
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.layout.addWidget(self.splitter)
self.tree = pg.TreeWidget()
self.sublayout = pg.GraphicsLayoutWidget()
self.splitter.addWidget(self.tree)
self.splitter.addWidget(self.sublayout)
self.plt = self.sublayout.addPlot()
setup_plot(self.plt)
pg.setConfigOptions(antialias=True)
self.tree.setHeaderHidden(True)
self.tree.setDragEnabled(False)
self.tree.setIndentation(10)
self.tree.setColumnCount(3)
self.tree.setColumnWidth(0, 110)
self.tree.setColumnWidth(1, 90)
self.tree.setColumnWidth(2, 5)
optItem = pg.TreeWidgetItem(['Options'])
xNameItem = pg.TreeWidgetItem(['x title'])
yNameItem = pg.TreeWidgetItem(['y title'])
optItem.addChild(xNameItem)
optItem.addChild(yNameItem)
addPlotItem = pg.TreeWidgetItem()
self.addPlotButton = QtGui.QPushButton('Add')
self.enterAction = QtGui.QAction('',self,shortcut='Return')
self.addAction(self.enterAction)
self.applyButton = QtGui.QPushButton('Apply')
self.applyButton.setDisabled(True)
addPlotItem.setWidget(0,self.applyButton)
addPlotItem.setWidget(1,self.addPlotButton)
self.items = pg.TreeWidgetItem(['Items'])
self.tree.addTopLevelItem(optItem)
self.tree.addTopLevelItem(self.items)
self.tree.addTopLevelItem(pg.TreeWidgetItem())
self.tree.addTopLevelItem(addPlotItem)
optItem.setExpanded(True)
self.xNameEdit = QtGui.QLineEdit('X')
self.yNameEdit = QtGui.QLineEdit('Y')
xNameItem.setWidget(1,self.xNameEdit)
yNameItem.setWidget(1,self.yNameEdit)
self.plt.setLabel('bottom', 'X',**LabelStyle)
self.plt.setLabel('left', 'Y',**LabelStyle)