eldond / pgmpl

A set of wrappers to allow calling of pyqtgraph functions with matplotlib syntax
MIT License
5 stars 0 forks source link

Make sure basic pgmpl use works within OMFIT #24

Closed eldond closed 6 years ago

eldond commented 6 years ago

The funny thing is that I can import pyqtmpl from the command line and make a figure with subplots and have no problems. That is, the figure will update and I also can keep running stuff from the command line. So, I know it's possible. Somehow.

eldond commented 6 years ago

When I launch from the console, I think PyQt is integrating with the interactive interpreter event loop.

That's why we rely on PyQt to hook into the ipython event loop instead.

https://groups.google.com/d/msg/pyqtgraph/dgXPbme8bDc/qemcEtE2BY0J

So, solving this requires integrating the PyQt event loop with OMFIT's tk event loop.

eldond commented 6 years ago

When using the OMFIT command box to make pyqtgraph figures (no pyqtmpl involved), the same problem occurs. Here's a minimal code snippet you can run in the command box to demonstrate:

import pyqtgraph as pg
from PyQt4 import QtGui

win = pg.GraphicsWindow()
lay = pg.GraphicsLayout()
win.setCentralItem(lay)
ax = pg.PlotItem()
lay.addItem(ax, 1, 1)

ax.plot([1, 2, 3])

QtGui.QApplication.instance().exec_()
eldond commented 6 years ago

Closing because pyqtmpl works as well as any PyQt application could work within a tk based framework. The problem has nothing to do with the pyqtmpl wrapper.