<div dir="ltr"><div>Phil,</div><div><br></div><div>Sorry for the delay, I'd forgotten to confirm your context manager "hack" had fixed the issue. That said, wouldn't be possible to have a proper fix without using a context manager at all? That'd be a much better clean&ideal solution so all existing pyqt application would benefit from the bug fix without changing any code, plus... in pyside2 the bug doesn't exist when using the normal way of creating the app instance, check this one out:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>USE_PYQT = True</div><div><br></div><div>if USE_PYQT:</div><div> from PyQt5.Qt import *</div><div>else:</div><div> from PySide2.QtGui import *</div><div> from PySide2.QtCore import *</div><div> from PySide2.QtWidgets import *</div><div><br></div><div>if __name__ == '__main__':</div><div> app = QApplication([])</div><div> w = QPlainTextEdit()</div><div> w.setPlainText("hello world")</div><div> w.show()</div><div> app.exec_()</div><div><br></div></blockquote>Regards</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 18, 2019 at 7:16 PM Scener Spanish <<a href="mailto:spscener84@gmail.com" target="_blank">spscener84@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Phil, that workaround sounds great!<div dir="auto"><br></div><div dir="auto">When I'm back home I'll check it out to confirm it'll work with this and the mcve provided in the other thread in pyqt mailing list. In the other thread you'll see when using pyside you don't need explicitely delete the app.</div><div dir="auto"><br></div><div dir="auto">In any case, my main goal was making sure you would become aware of this one :)</div><div dir="auto"><br></div><div dir="auto">Thanks for looking into it</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mar., 18 jun. 2019 18:59, Phil Thompson <<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 18/06/2019 15:02, Scener Spanish wrote:<br>
> Let's continue this conversation on my other message related to this in <br>
> the<br>
> pyqt mailing list. Also, make sure you don't open the viewer till <br>
> you've<br>
> closed the app... In fact, you don't even need a clip viewer, the<br>
> information won't be copied properly. Did you check on win7 or higher?<br>
> <br>
> Thanks<br>
> <br>
> El mar., 18 jun. 2019 15:58, Phil Thompson <br>
> <<a href="mailto:phil@riverbankcomputing.com" rel="noreferrer" target="_blank">phil@riverbankcomputing.com</a>><br>
> escribió:<br>
> <br>
>> On 14/06/2019 12:13, Scener Spanish wrote:<br>
>> > I forgot to add the line `w.selectAll()` after w.show() in my previous<br>
>> > snippet... btw, it'd be great having a github repo to report<br>
>> > pyqt/qscintilla issues... mailing lists<br>
>> > was a good thing in the 90s, not anymore ;D<br>
>> ><br>
>> > On Fri, Jun 14, 2019 at 1:05 PM Scener Spanish <<a href="mailto:spscener84@gmail.com" rel="noreferrer" target="_blank">spscener84@gmail.com</a>><br>
>> > wrote:<br>
>> ><br>
>> >> Hi, consider this snippet:<br>
>> >><br>
>> >> from PyQt5.Qt import *<br>
>> >> from PyQt5.Qsci import QsciScintilla<br>
>> >><br>
>> >><br>
>> >> if __name__ == '__main__':<br>
>> >> app = QApplication([])<br>
>> >> w = QsciScintilla()<br>
>> >> w.setText("hello world")<br>
>> >> w.show()<br>
>> >> app.exec_()<br>
>> >><br>
>> >> *Test1) *Run it, press ctrl+c, close the window and then open your<br>
>> >> system<br>
>> >> clipboard viewer... for some reason on windows7 the is broken, you'll<br>
>> >> binary content --> this<br>
>> >> <<br>
>> <a href="https://dl.dropboxusercontent.com/s/gtf9cgg1cygbre4/clipbrd_2019-06-14_12-56-37.png" rel="noreferrer noreferrer" target="_blank">https://dl.dropboxusercontent.com/s/gtf9cgg1cygbre4/clipbrd_2019-06-14_12-56-37.png</a>><br>
>> <br>
>> >> . That<br>
>> >> means you won't be able to paste the content on a text editor.<br>
>> >><br>
>> >> *Test2) *Run it, press ctrl+c and then open your system clipboard<br>
>> >> viewer,<br>
>> >> in this case you'll be able to see the copied content correctly, like<br>
>> >> this<br>
>> >> <<br>
>> <a href="https://dl.dropboxusercontent.com/s/8xq5riznnxs07cg/clipbrd_2019-06-14_12-59-06.png" rel="noreferrer noreferrer" target="_blank">https://dl.dropboxusercontent.com/s/8xq5riznnxs07cg/clipbrd_2019-06-14_12-59-06.png</a><br>
>> ><br>
>> >> .<br>
>> >><br>
>> >> This issue has really annoyed me in the past many times but I didn't<br>
>> >> know<br>
>> >> how to reproduce it or what was the reason why the content I'd copied<br>
>> >> from<br>
>> >> my app couldn't be pasted anymore<br>
>> >><br>
>> >> *Requirements:*<br>
>> >><br>
>> >> windows 7 ultimate<br>
>> >> Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32<br>
>> >> bit<br>
>> >> (Intel)] on win32<br>
>> >><br>
>> >> QScintilla==2.11.2.dev1905151033<br>
>> >> PyQt5==5.12.2<br>
>> >> PyQt5-sip==4.19.17<br>
>> <br>
>> There is no system clipboard viewer on Windows. With...<br>
>> <br>
>> <a href="http://www.freeclipboardviewer.com" rel="noreferrer noreferrer" target="_blank">http://www.freeclipboardviewer.com</a><br>
>> <br>
>> ...it seems to work fine.<br>
>> <br>
>> Phil<br>
<br>
Ok I can now reproduce the problem. It also happens with C++ when the <br>
QApplication is created on the heap and not explicitly destroyed.<br>
<br>
The workaround in your test is to 'del app' at the end of the script.<br>
<br>
Tonight's PyQt snapshot adds support for using QCoreApplication (and <br>
sub-classes) as a context manager which calls the C++ dtor when exiting <br>
the context. So...<br>
<br>
with QApplication([]) as app:<br>
....<br>
app->exec()<br>
<br>
Phil<br>
<br>
Phil<br>
</blockquote></div>
</blockquote></div>