[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] PyQt event linking to jupyter/ipython notebook cell
From:       Cat <mitelutco () gmail ! com>
Date:       2016-10-17 23:19:28
Message-ID: CAPS8Vh0fvv9d_ArRbHu_iLZSzwYKL13asD1kHvVj=5xkOCvMWg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello

I was wondering if anyone knows how to enable jupyter notebook to interact
with a PyQt generated widget after calling app.exec_()?    The intrinsic
mouseEvent() functions do work, but the cells in the notebook are locked
out until the widget is closed manually.

It seems I have to call/execute the QApplication in a special way or
connect the notebook to it somehow, but can't figure it out.

Thanks,
Catubc

#FIGURE CLASS: initialization of figure object and execution

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_()

#JUPYTER NOTEBOOK CODE: figure instantiation and display
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

[Attachment #5 (text/html)]

<div dir="ltr">Hello<div><br></div><div>I was wondering if anyone knows how to enable \
jupyter notebook to interact with a PyQt generated widget after calling app.exec_()?  \
The intrinsic mouseEvent() functions do work, but the cells in the notebook are \
locked out until the widget is closed manually.  </div><div><br></div><div>It seems I \
have to call/execute the QApplication in a special way or connect the notebook to it \
somehow, but can&#39;t figure it \
out.</div><div><br></div><div>Thanks,</div><div>Catubc</div><div><br></div><div><pre \
style="white-space:pre-wrap;font-size:12.8px;padding:5px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,&quot;lucida \
console&quot;,&quot;liberation mono&quot;,&quot;dejavu sans \
mono&quot;,&quot;bitstream vera sans mono&quot;,&quot;courier \
new&quot;,monospace,sans-serif;background-color:rgb(239,240,241);word-wrap:normal;color:rgb(36,39,41)">#FIGURE \
CLASS: initialization of figure object and execution</pre><pre \
style="white-space:pre-wrap;font-size:12.8px;padding:5px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,&quot;lucida \
console&quot;,&quot;liberation mono&quot;,&quot;dejavu sans \
mono&quot;,&quot;bitstream vera sans mono&quot;,&quot;courier \
new&quot;,monospace,sans-serif;background-color:rgb(239,240,241);word-wrap:normal;color:rgb(36,39,41)"><code \
style="font-family:consolas,menlo,monaco,&quot;lucida console&quot;,&quot;liberation \
mono&quot;,&quot;dejavu sans mono&quot;,&quot;bitstream vera sans \
mono&quot;,&quot;courier new&quot;,monospace,sans-serif;white-space:inherit">class \
Figure(object):  &#39;&#39;&#39;
    Main API functions
    &#39;&#39;&#39;

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

    def show(self):   #Show
        self.GUI = GLWindow(data)   
        self.app.exec_()</code></pre><pre \
style="white-space:pre-wrap;font-size:12.8px;padding:5px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,&quot;lucida \
console&quot;,&quot;liberation mono&quot;,&quot;dejavu sans \
mono&quot;,&quot;bitstream vera sans mono&quot;,&quot;courier \
new&quot;,monospace,sans-serif;background-color:rgb(239,240,241);word-wrap:normal;color:rgb(36,39,41)"><code \
style="font-family:consolas,menlo,monaco,&quot;lucida console&quot;,&quot;liberation \
mono&quot;,&quot;dejavu sans mono&quot;,&quot;bitstream vera sans \
mono&quot;,&quot;courier new&quot;,monospace,sans-serif;white-space:inherit"><pre \
style="white-space:pre-wrap;font-size:12.8px;padding:5px;width:auto;max-height:600px;overflow:auto;font-family:consolas,menlo,monaco,&quot;lucida \
console&quot;,&quot;liberation mono&quot;,&quot;dejavu sans \
mono&quot;,&quot;bitstream vera sans mono&quot;,&quot;courier \
new&quot;,monospace,sans-serif;word-wrap:normal"><code \
style="font-family:consolas,menlo,monaco,&quot;lucida console&quot;,&quot;liberation \
mono&quot;,&quot;dejavu sans mono&quot;,&quot;bitstream vera sans \
mono&quot;,&quot;courier new&quot;,monospace,sans-serif;white-space:inherit">#JUPYTER \
NOTEBOOK CODE: figure instantiation and display 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</code></pre></code></pre></div></div>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic