Other way to make your app working is to add:
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
to the end of your code.
That's way is mentioned in most of the examples
http://www.pyqtgraph.org/downloads/0.10.0/pyqtgraph-0.10.0-deb/pyqtgraph-0.10.0/examples/,
but I think that is easier for start to have your own while loop instead to
use update() function as in some examples.
On Wed, Jul 3, 2019 at 4:05 AM Radhika Prasad <[email protected]> wrote:
> Thanks. It works.
> Just curious: This command is not mentioned in the documentation so how
> does one learn more about it?
>
> On Monday, July 1, 2019 at 9:28:31 AM UTC+5:30, [email protected] wrote:
>>
>> Add to end of your code:
>>
>> while w.isVisible():
>> app.processEvents()
>>
>> That's all,
>> Vasilije
>>
>>
>>
>> On Sun, Jun 30, 2019 at 8:38 PM Radhika Prasad <[email protected]> wrote:
>>
>>> I have tried using the pyqtgraph surface plot example for obtaining a
>>> surface plot. Unfortunately, nothing appears. Please help.
>>> Even in the example code, if I comment out everything else except for
>>> the saddle surface plot, then also nothing appears.
>>>
>>> Here is the code:
>>>
>>> from pyqtgraph.Qt import QtCore, QtGui
>>> import pyqtgraph as pg
>>> import pyqtgraph.opengl as gl
>>> import numpy as np
>>>
>>> ## Create a GL View widget to display data
>>> app = QtGui.QApplication([])
>>> w = gl.GLViewWidget()
>>> w.show()
>>> w.setWindowTitle('pyqtgraph example: GLSurfacePlot')
>>> #w.setCameraPosition(distance=50)
>>>
>>> g = gl.GLGridItem()
>>> g.scale(2,2,1)
>>> g.setDepthValue(10) # draw grid after surfaces since they may be
>>> translucent
>>> w.addItem(g)
>>>
>>> x = np.linspace(-8, 8, 50)
>>> y = np.linspace(-8, 8, 50)
>>> #z = np.exp((-x.reshape(50,1) ** 2) - (y.reshape(1,50) ** 2))
>>> z = x.reshape(50,1)+y.reshape(1,50)
>>> p = gl.GLSurfacePlotItem(x=x, y=y, z=z, shader='normalColor')
>>> #p2.translate(-10,-10,0)
>>> w.addItem(p)
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "pyqtgraph" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/pyqtgraph/43710773-a836-427a-816a-fa36ab2cc507%40googlegroups.com
>>> <https://groups.google.com/d/msgid/pyqtgraph/43710773-a836-427a-816a-fa36ab2cc507%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "pyqtgraph" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyqtgraph/096bc9d0-dba1-45ba-9db0-2b8c04386772%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/096bc9d0-dba1-45ba-9db0-2b8c04386772%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/pyqtgraph/CAD_qyJr2pF7mi0A6EpZqezk25ZBM7FDO9Lmq41S001px9oE30A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.