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

List:       pykde
Subject:    Re: Bizarre bug with Qt programs under WSL2 on Win 11
From:       Barry <barry () barrys-emacs ! org>
Date:       2021-11-06 8:56:51
Message-ID: 6B1EE0B6-F19F-4E1C-818E-613EC9696349 () barrys-emacs ! org
[Download RAW message or body]

> On 5 Nov 2021, at 18:42, Damon Lynch <damonlynch@gmail.com> wrote:
> 
> 
> Hi there,
> 
> It's not PyQt specific. Use Ctrl-Q to quit from a Qt program, and it's as if the \
> same key combo is pressed when you start any Qt program again, i.e. the program \
> quits instantly. Start another or the same Qt program, and it's as if the q key is \
> being pressed down on the keyboard (even though it's not). It's so strange I made a \
> video to illustrate: 
> https://youtu.be/MflcrMMlNnc

I think you can raise a bug on GitHub against wsl2 these days.
Sorry did not hunt down which project to do that on.

Barry

> 
> Tested under Ubuntu 20.04 & 21.10, with distro Qt packages and with the PyQt5 pip \
> package. Same result. Qt6 not tested. Non Qt programs seem unaffected. 
> This is the same code if you want to try it yourself (or just start qt assistant or \
> similar): 
> import pkg_resources
> import platform
> import sys
> from PyQt5.QtWidgets import QApplication, QTextEdit, QMainWindow, QAction, QToolBar
> from PyQt5.QtCore import PYQT_VERSION_STR, QT_VERSION_STR
> from PyQt5.QtGui import QTextCursor
> 
> 
> class Window(QMainWindow):
> def __init__(self):
> super().__init__()
> self.textEdit = QTextEdit()
> self.setCentralWidget(self.textEdit)
> self.setWindowTitle("Catch Input Example")
> self.setMinimumWidth(500)
> self.toolbar = QToolBar("Catch Input Toolbar")
> self.addToolBar(self.toolbar)
> self.quitAct = QAction("&Quit", self, shortcut="Ctrl+Q", triggered=self.close)
> self.toolbar.addAction(self.quitAct)
> location = (
> pkg_resources.get_distribution("PyQt5").location
> )
> self.textEdit.setText(
> f"Platform: {platform.platform()}\n"
> f"PyQt: {PYQT_VERSION_STR}\n"
> f"Qt: {QT_VERSION_STR}\n"
> f"PyQt5 location: {location}\n"
> )
> self.textEdit.moveCursor(QTextCursor.End)
> self.move(10, 10)
> 
> 
> if __name__ == "__main__":
> app = QApplication(sys.argv)
> window = Window()
> 
> window.show()
> sys.exit(app.exec_())
> 
> -- 
> https://damonlynch.net


[Attachment #3 (text/html)]

<html><head><meta http-equiv="content-type" content="text/html; \
charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div \
dir="ltr"><br></div><div dir="ltr"><br><blockquote type="cite">On 5 Nov 2021, at \
18:42, Damon Lynch &lt;damonlynch@gmail.com&gt; \
wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div \
dir="ltr"><div>Hi there,</div><div><br></div><div> It's not PyQt specific. 

Use Ctrl-Q to quit from a Qt program, and it's as if the same key combo is pressed \
when you start any Qt program again, i.e. the program quits instantly. Start another \
or the same Qt program, and it's as if the q key is being pressed down on the \
keyboard (even though it's not). It's so strange I made a video to \
illustrate:</div><div><br></div><div><a \
href="https://youtu.be/MflcrMMlNnc">https://youtu.be/MflcrMMlNnc</a></div></div></div></blockquote><div><br></div>I \
think you can raise a bug on GitHub against wsl2 these days.<div>Sorry did not hunt \
down which project to do that \
on.<br><div><br></div><div>Barry</div><div><br><blockquote type="cite"><div \
dir="ltr"><div dir="ltr"><div><br></div><div>Tested under Ubuntu 20.04 &amp; 21.10, \
with distro Qt packages and with the PyQt5 pip package. Same result. Qt6 not tested. \
Non Qt programs seem unaffected.<br></div><div><br></div><div>This is the same code \
if you want to try it yourself (or just start qt assistant or \
similar):</div><div><br></div><div><pre \
style="background-color:rgb(255,255,255);color:rgb(8,8,8);font-family:&quot;JetBrains \
Mono&quot;,monospace;font-size:9pt"><span style="color:rgb(0,51,179)">import \
</span>pkg_resources<br><span style="color:rgb(0,51,179)">import \
</span>platform<br><span style="color:rgb(0,51,179)">import </span>sys<br><span \
style="color:rgb(0,51,179)">from </span>PyQt5.QtWidgets <span \
style="color:rgb(0,51,179)">import </span>QApplication, QTextEdit, QMainWindow, \
QAction, QToolBar<br><span style="color:rgb(0,51,179)">from </span>PyQt5.QtCore <span \
style="color:rgb(0,51,179)">import </span>PYQT_VERSION_STR, QT_VERSION_STR<br><span \
style="color:rgb(0,51,179)">from </span>PyQt5.QtGui <span \
style="color:rgb(0,51,179)">import </span>QTextCursor<br><br><br><span \
style="color:rgb(0,51,179)">class </span><span \
style="color:rgb(0,0,0)">Window</span>(QMainWindow):<br>    <span \
style="color:rgb(0,51,179)">def </span><span \
style="color:rgb(178,0,178)">__init__</span>(<span \
style="color:rgb(148,85,141)">self</span>):<br>        <span \
style="color:rgb(0,0,128)">super</span>().<span \
style="color:rgb(178,0,178)">__init__</span>()<br>        <span \
style="color:rgb(148,85,141)">self</span>.textEdit = QTextEdit()<br>        <span \
style="color:rgb(148,85,141)">self</span>.setCentralWidget(<span \
style="color:rgb(148,85,141)">self</span>.textEdit)<br>        <span \
style="color:rgb(148,85,141)">self</span>.setWindowTitle(<span \
style="color:rgb(6,125,23)">"Catch Input Example"</span>)<br>        <span \
style="color:rgb(148,85,141)">self</span>.setMinimumWidth(<span \
style="color:rgb(23,80,235)">500</span>)<br>        <span \
style="color:rgb(148,85,141)">self</span>.toolbar = QToolBar(<span \
style="color:rgb(6,125,23)">"Catch Input Toolbar"</span>)<br>        <span \
style="color:rgb(148,85,141)">self</span>.addToolBar(<span \
style="color:rgb(148,85,141)">self</span>.toolbar)<br>        <span \
style="color:rgb(148,85,141)">self</span>.quitAct = QAction(<span \
style="color:rgb(6,125,23)">"&amp;Quit"</span>, <span \
style="color:rgb(148,85,141)">self</span>, <span \
style="color:rgb(102,0,153)">shortcut</span>=<span \
style="color:rgb(6,125,23)">"Ctrl+Q"</span>, <span \
style="color:rgb(102,0,153)">triggered</span>=<span \
style="color:rgb(148,85,141)">self</span>.close)<br>        <span \
style="color:rgb(148,85,141)">self</span>.toolbar.addAction(<span \
style="color:rgb(148,85,141)">self</span>.quitAct)<br>        location = (<br>        \
pkg_resources.get_distribution(<span \
style="color:rgb(6,125,23)">"PyQt5"</span>).location<br>        )<br>        <span \
style="color:rgb(148,85,141)">self</span>.textEdit.setText(<br>            <span \
style="color:rgb(6,125,23)">f"Platform: </span><span \
style="color:rgb(0,55,166)">{</span>platform.platform()<span \
style="color:rgb(0,55,166)">}\n</span><span \
style="color:rgb(6,125,23)">"<br></span><span style="color:rgb(6,125,23)">            \
f"PyQt: </span><span style="color:rgb(0,55,166)">{</span>PYQT_VERSION_STR<span \
style="color:rgb(0,55,166)">}\n</span><span \
style="color:rgb(6,125,23)">"<br></span><span style="color:rgb(6,125,23)">            \
f"Qt: </span><span style="color:rgb(0,55,166)">{</span>QT_VERSION_STR<span \
style="color:rgb(0,55,166)">}\n</span><span \
style="color:rgb(6,125,23)">"<br></span><span style="color:rgb(6,125,23)">            \
f"PyQt5 location: </span><span style="color:rgb(0,55,166)">{</span>location<span \
style="color:rgb(0,55,166)">}\n</span><span \
style="color:rgb(6,125,23)">"<br></span><span style="color:rgb(6,125,23)">        \
</span>)<br>        <span \
style="color:rgb(148,85,141)">self</span>.textEdit.moveCursor(QTextCursor.End)<br>    \
<span style="color:rgb(148,85,141)">self</span>.move(<span \
style="color:rgb(23,80,235)">10</span>, <span \
style="color:rgb(23,80,235)">10</span>)<br><br><br><span \
style="color:rgb(0,51,179)">if </span>__name__ == <span \
style="color:rgb(6,125,23)">"__main__"</span>:<br>    app = \
QApplication(sys.argv)<br>    window = Window()<br><br>    window.show()<br>    \
sys.exit(app.exec_())<br></pre></div><div><br>-- <br><div dir="ltr" \
class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><a \
href="https://damonlynch.net" \
target="_blank">https://damonlynch.net</a><br></div></div></div></div> \
</div></blockquote></div></div></body></html>



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

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