I have an annoying issue that I have not been able to solve for the past few months. Basically, I'm using jupyter/ipython notebook as an API to call pyqt and display 3d geometric data. This is how I initialize the app into an object and after I add some polygons and points, I call show():


class Figure(object):
'''
Main API functions
'''

def __init__(self):
print "... initializing canvas ..."
self.app = QApplication(sys.argv)
self.app.processEvents()
...

def show(self): #Show
self.GUI = GLWindow(data)
self.app.exec_()



The problem is that once I call the show command in the jupyter notebook I can't do live updates to the widget as the notebook input is locked out:

#Initialize figure object inside the notebook
fig = plb.figure()
...
fig.show() #Locks out any further jupyter commands while widget on screen
fig.update() #Does not get executed until widget is closed

I already have the mouse events working fine (i.e. I can rotate and click on the widget window displaying 3D info) using intrinsic functions like mouseMoveEvent() that are inside the widget code:


class GLWindow(QtGui.QWidget):

def __init__(self, fig, parent=None):
QtGui.QWidget.__init__(self, parent)

self.glWidget = GLWidget(fig, parent=self)
...

class GLWidget(QtOpenGL.QGLWidget):

def __init__(self, fig, parent=None):
QtOpenGL.QGLWidget.__init__(self, parent)
...

def mouseMoveEvent(self, event):
buttons = event.buttons()
modifiers = event.modifiers()
dx = event.x() - self.lastPos.x()
dy = event.y() - self.lastPos.y()
...

But I can't figure out how to use events to call the widget app from outside the widget code so the notebook can interact with the app. I've tried to follow a couple of related suggestions, but it is not clear to me how to do this.

Any help is appreciated, I've spent so many hours on trying to fix this it's embarrassing. Cat