commit
191ce8bf85
@ -12,7 +12,7 @@ import numpy as np
|
||||
# Enable antialiasing for prettier plots
|
||||
pg.setConfigOptions(antialias=True)
|
||||
|
||||
w = pg.GraphicsWindow()
|
||||
w = pg.GraphicsLayoutWidget(show=True)
|
||||
w.setWindowTitle('pyqtgraph example: CustomGraphItem')
|
||||
v = w.addViewBox()
|
||||
v.setAspectLocked()
|
||||
|
@ -13,7 +13,7 @@ import numpy as np
|
||||
# Enable antialiasing for prettier plots
|
||||
pg.setConfigOptions(antialias=True)
|
||||
|
||||
w = pg.GraphicsWindow()
|
||||
w = pg.GraphicsLayoutWidget(show=True)
|
||||
w.setWindowTitle('pyqtgraph example: GraphItem')
|
||||
v = w.addViewBox()
|
||||
v.setAspectLocked()
|
||||
|
@ -10,7 +10,7 @@ import pyqtgraph as pg
|
||||
|
||||
|
||||
app = QtGui.QApplication([])
|
||||
win = pg.GraphicsWindow(title="Plotting items examples")
|
||||
win = pg.GraphicsLayoutWidget(show=True, title="Plotting items examples")
|
||||
win.resize(1000,600)
|
||||
|
||||
# Enable antialiasing for prettier plots
|
||||
|
@ -12,7 +12,7 @@ import pyqtgraph as pg
|
||||
|
||||
app = QtGui.QApplication([])
|
||||
|
||||
win = pg.GraphicsWindow(title="Basic plotting examples")
|
||||
win = pg.GraphicsLayoutWidget(show=True, title="Basic plotting examples")
|
||||
win.resize(1000,600)
|
||||
win.setWindowTitle('pyqtgraph example: LogPlotTest')
|
||||
|
||||
|
@ -9,7 +9,7 @@ import pyqtgraph as pg
|
||||
from pyqtgraph.Qt import QtCore, QtGui
|
||||
import numpy as np
|
||||
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.setWindowTitle('pyqtgraph example: PanningPlot')
|
||||
|
||||
plt = win.addPlot()
|
||||
|
@ -16,7 +16,7 @@ app = QtGui.QApplication([])
|
||||
#mw = QtGui.QMainWindow()
|
||||
#mw.resize(800,800)
|
||||
|
||||
win = pg.GraphicsWindow(title="Plot auto-range examples")
|
||||
win = pg.GraphicsLayoutWidget(show=True, title="Plot auto-range examples")
|
||||
win.resize(800,600)
|
||||
win.setWindowTitle('pyqtgraph example: PlotAutoRange')
|
||||
|
||||
|
@ -17,7 +17,7 @@ app = QtGui.QApplication([])
|
||||
#mw = QtGui.QMainWindow()
|
||||
#mw.resize(800,800)
|
||||
|
||||
win = pg.GraphicsWindow(title="Basic plotting examples")
|
||||
win = pg.GraphicsLayoutWidget(show=True, title="Basic plotting examples")
|
||||
win.resize(1000,600)
|
||||
win.setWindowTitle('pyqtgraph example: Plotting')
|
||||
|
||||
|
@ -33,7 +33,7 @@ arr[8:13, 44:46] = 10
|
||||
|
||||
## create GUI
|
||||
app = QtGui.QApplication([])
|
||||
w = pg.GraphicsWindow(size=(1000,800), border=True)
|
||||
w = pg.GraphicsLayoutWidget(show=True, size=(1000,800), border=True)
|
||||
w.setWindowTitle('pyqtgraph example: ROI Examples')
|
||||
|
||||
text = """Data Selection From Image.<br>\n
|
||||
|
@ -13,7 +13,7 @@ pg.setConfigOptions(imageAxisOrder='row-major')
|
||||
## create GUI
|
||||
app = QtGui.QApplication([])
|
||||
|
||||
w = pg.GraphicsWindow(size=(800,800), border=True)
|
||||
w = pg.GraphicsLayoutWidget(show=True, size=(800,800), border=True)
|
||||
v = w.addViewBox(colspan=2)
|
||||
v.invertY(True) ## Images usually have their Y-axis pointing downward
|
||||
v.setAspectLocked(True)
|
||||
|
@ -9,7 +9,7 @@ from pyqtgraph.Qt import QtCore, QtGui
|
||||
import numpy as np
|
||||
|
||||
pg.mkQApp()
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.setWindowTitle('pyqtgraph example: ScaleBar')
|
||||
|
||||
vb = win.addViewBox()
|
||||
|
@ -11,7 +11,7 @@ from pyqtgraph.Qt import QtGui, QtCore
|
||||
import pyqtgraph as pg
|
||||
|
||||
app = QtGui.QApplication([])
|
||||
win = pg.GraphicsWindow(title="Scatter Plot Symbols")
|
||||
win = pg.GraphicsLayoutWidget(show=True, title="Scatter Plot Symbols")
|
||||
win.resize(1000,600)
|
||||
|
||||
pg.setConfigOptions(antialias=True)
|
||||
|
@ -16,7 +16,7 @@ x = np.arange(1000, dtype=float)
|
||||
y = np.random.normal(size=1000)
|
||||
y += 5 * np.sin(x/100)
|
||||
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.setWindowTitle('pyqtgraph example: ____')
|
||||
win.resize(1000, 800)
|
||||
win.ci.setBorder((50, 50, 100))
|
||||
|
@ -14,7 +14,7 @@ import pyqtgraph as pg
|
||||
from pyqtgraph.Qt import QtCore, QtGui
|
||||
import numpy as np
|
||||
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.setWindowTitle('pyqtgraph example: context menu')
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ from pyqtgraph.Point import Point
|
||||
|
||||
#generate layout
|
||||
app = QtGui.QApplication([])
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.setWindowTitle('pyqtgraph example: crosshair')
|
||||
label = pg.LabelItem(justify='right')
|
||||
win.addItem(label)
|
||||
|
@ -8,7 +8,7 @@ import pyqtgraph as pg
|
||||
from pyqtgraph.Qt import QtCore, QtGui
|
||||
import numpy as np
|
||||
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.resize(800,350)
|
||||
win.setWindowTitle('pyqtgraph example: Histogram')
|
||||
plt1 = win.addPlot()
|
||||
|
@ -20,7 +20,7 @@ data = np.concatenate([data, data], axis=0)
|
||||
data = pg.gaussianFilter(data, (10, 10, 10))[frames/2:frames + frames/2]
|
||||
data[:, 15:16, 15:17] += 1
|
||||
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.setWindowTitle('pyqtgraph example: Isocurve')
|
||||
vb = win.addViewBox()
|
||||
img = pg.ImageItem(data[0])
|
||||
|
@ -20,7 +20,7 @@ app = QtGui.QApplication([])
|
||||
x = np.linspace(-50, 50, 1000)
|
||||
y = np.sin(x) / x
|
||||
|
||||
win = pg.GraphicsWindow(title="pyqtgraph example: Linked Views")
|
||||
win = pg.GraphicsLayoutWidget(show=True, title="pyqtgraph example: Linked Views")
|
||||
win.resize(800,600)
|
||||
|
||||
win.addLabel("Linked Views", colspan=2)
|
||||
|
@ -11,7 +11,7 @@ import pyqtgraph as pg
|
||||
|
||||
app = QtGui.QApplication([])
|
||||
|
||||
w = pg.GraphicsWindow()
|
||||
w = pg.GraphicsLayoutWidget(show=True)
|
||||
w.setWindowTitle('pyqtgraph example: logAxis')
|
||||
p1 = w.addPlot(0,0, title="X Semilog")
|
||||
p2 = w.addPlot(1,0, title="Y Semilog")
|
||||
|
@ -17,7 +17,7 @@ from pyqtgraph import Point
|
||||
|
||||
app = pg.QtGui.QApplication([])
|
||||
|
||||
w = pg.GraphicsWindow(border=0.5)
|
||||
w = pg.GraphicsLayoutWidget(show=True, border=0.5)
|
||||
w.resize(1000, 900)
|
||||
w.show()
|
||||
|
||||
|
@ -8,7 +8,7 @@ import pyqtgraph as pg
|
||||
from pyqtgraph.Qt import QtCore, QtGui
|
||||
import numpy as np
|
||||
|
||||
win = pg.GraphicsWindow()
|
||||
win = pg.GraphicsLayoutWidget(show=True)
|
||||
win.setWindowTitle('pyqtgraph example: Scrolling Plots')
|
||||
|
||||
|
||||
|
@ -272,3 +272,11 @@ m = re.match(r'(\d+)\.(\d+).*', QtVersion)
|
||||
if m is not None and list(map(int, m.groups())) < versionReq:
|
||||
print(list(map(int, m.groups())))
|
||||
raise Exception('pyqtgraph requires Qt version >= %d.%d (your version is %s)' % (versionReq[0], versionReq[1], QtVersion))
|
||||
|
||||
|
||||
QAPP = None
|
||||
def mkQApp():
|
||||
global QAPP
|
||||
if QtGui.QApplication.instance() is None:
|
||||
QAPP = QtGui.QApplication([])
|
||||
return QAPP
|
||||
|
@ -10,7 +10,7 @@ __version__ = '0.10.0'
|
||||
|
||||
## 'Qt' is a local module; it is intended mainly to cover up the differences
|
||||
## between PyQt4 and PySide.
|
||||
from .Qt import QtGui
|
||||
from .Qt import QtGui, mkQApp
|
||||
|
||||
## not really safe--If we accidentally create another QApplication, the process hangs (and it is very difficult to trace the cause)
|
||||
#if QtGui.QApplication.instance() is None:
|
||||
@ -466,14 +466,3 @@ def stack(*args, **kwds):
|
||||
except NameError:
|
||||
consoles = [c]
|
||||
return c
|
||||
|
||||
|
||||
def mkQApp():
|
||||
global QAPP
|
||||
inst = QtGui.QApplication.instance()
|
||||
if inst is None:
|
||||
QAPP = QtGui.QApplication([])
|
||||
else:
|
||||
QAPP = inst
|
||||
return QAPP
|
||||
|
||||
|
@ -6,17 +6,11 @@ it is possible to place any widget into its own window by simply calling its
|
||||
show() method.
|
||||
"""
|
||||
|
||||
from .Qt import QtCore, QtGui
|
||||
from .Qt import QtCore, QtGui, mkQApp
|
||||
from .widgets.PlotWidget import *
|
||||
from .imageview import *
|
||||
from .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget
|
||||
from .widgets.GraphicsView import GraphicsView
|
||||
QAPP = None
|
||||
|
||||
def mkQApp():
|
||||
if QtGui.QApplication.instance() is None:
|
||||
global QAPP
|
||||
QAPP = QtGui.QApplication([])
|
||||
|
||||
|
||||
class GraphicsWindow(GraphicsLayoutWidget):
|
||||
|
@ -1,4 +1,4 @@
|
||||
from ..Qt import QtGui
|
||||
from ..Qt import QtGui, mkQApp
|
||||
from ..graphicsItems.GraphicsLayout import GraphicsLayout
|
||||
from .GraphicsView import GraphicsView
|
||||
|
||||
@ -48,6 +48,7 @@ class GraphicsLayoutWidget(GraphicsView):
|
||||
:func:`clear <pyqtgraph.GraphicsLayout.clear>`
|
||||
"""
|
||||
def __init__(self, parent=None, show=False, size=None, title=None, **kargs):
|
||||
mkQApp()
|
||||
GraphicsView.__init__(self, parent)
|
||||
self.ci = GraphicsLayout(**kargs)
|
||||
for n in ['nextRow', 'nextCol', 'nextColumn', 'addPlot', 'addViewBox', 'addItem', 'getItem', 'addLayout', 'addLabel', 'removeItem', 'itemIndex', 'clear']:
|
||||
|
@ -1,21 +0,0 @@
|
||||
## just import everything from sub-modules
|
||||
|
||||
#import os
|
||||
|
||||
#d = os.path.split(__file__)[0]
|
||||
#files = []
|
||||
#for f in os.listdir(d):
|
||||
#if os.path.isdir(os.path.join(d, f)):
|
||||
#files.append(f)
|
||||
#elif f[-3:] == '.py' and f != '__init__.py':
|
||||
#files.append(f[:-3])
|
||||
|
||||
#for modName in files:
|
||||
#mod = __import__(modName, globals(), locals(), fromlist=['*'])
|
||||
#if hasattr(mod, '__all__'):
|
||||
#names = mod.__all__
|
||||
#else:
|
||||
#names = [n for n in dir(mod) if n[0] != '_']
|
||||
#for k in names:
|
||||
#print modName, k
|
||||
#globals()[k] = getattr(mod, k)
|
Loading…
Reference in New Issue
Block a user