plotwindow crash on win10

51 views
Skip to first unread message

Ted Zeng

unread,
Oct 3, 2019, 2:08:02 PM10/3/19
to pyqtgraph
when I use the following code, the graph crashed.

import pyqtgraph as pg
win = pg.GraphicsWindow()

However, when I run the examples, it works.

import pyqtgraph.examples
pyqtgraph.examples.run()


My system configure:
windows 10, 64
python 3.7


I also find similar bug in this post :https://bugs.launchpad.net/pyqtgraph/+bug/1782302

Pleadse advice me how to solve this problem, thanks

Ted

Kenneth Lyons

unread,
Oct 5, 2019, 12:10:31 PM10/5/19
to pyqtgraph
Note that GraphicsWindow is deprecated in favor of GraphicsLayoutWidget, but in any case, you'll need to make sure you show the window. In addition, unless you're running this code in an interactive environment (e.g. the Python/IPython REPL or running a script with the -i flag), you also need to run the Qt event loop at the end. Does the following work?

import pyqtgraph as pg
gw
= pg.GraphicsWindow()
gw
.show()
pg
.mkQApp().exec_()

The documentation here is incomplete but may be helpful: http://pyqtgraph.org/documentation/qtcrashcourse.html

Ted Zeng

unread,
Oct 7, 2019, 12:41:12 AM10/7/19
to pyqtgraph
Yes, the following works, Thanks.

Ted Zeng

unread,
Oct 8, 2019, 9:59:09 AM10/8/19
to pyqtgraph
I find the following post really help. 

"If you want interactive plotting then first type %gui qt in IPython (i.e. Jupyter or PyQt Console). This will enable GUI event loop integration. In the past PyQT could do this by itself but I don't know if it still can, so I would just use IPython for this – titusjan Apr 22 '17 at 11:31 "
Reply all
Reply to author
Forward
0 new messages