<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">So it does, and changing that makes it work like the C++ example.<div class=""><br class=""></div><div class="">My own app is still showing the problem even without using QOpenGLWidget. I wonder if there is some setting somewhere that implicitly uses QOpenGLWidget….<br class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Oct 5, 2019, at 5:36 PM, Eric Pettersen <<a href="mailto:pett@cgl.ucsf.edu" class="">pett@cgl.ucsf.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Your Python class inherits from QOpenGLWidget. Your C++ class inherits from QWidget.<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Oct 5, 2019, at 2:10 PM, Patrick Stinson <<a href="mailto:patrickkidd@gmail.com" class="">patrickkidd@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">On MacOS, a QMainWindow with a simple painted centralWidget flickers when resizing quickly in python but not in C++. This only occurs with QMainWindow It is particularly pronounced more complex widgets, as shown in the following video:</div><div class=""><br class=""></div><div class=""><a href="https://youtu.be/0Qjy2wm6m9M" class="">https://youtu.be/0Qjy2wm6m9M</a></div><div class=""><br class=""></div><div class="">Here is the python example that shows the bug. Just run, rapidly resize the height of the widget , and observe a black flickering on the top edge of the widget as the height changes.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c200ff" class="">class</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #2d961e" class="">Widget</span><span style="font-variant-ligatures: no-common-ligatures" class="">(QOpenGLWidget):</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c200ff" class="">def</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #6c6c1d" class="">paintEvent</span><span style="font-variant-ligatures: no-common-ligatures" class="">(</span><span style="font-variant-ligatures: no-common-ligatures; color: #c200ff" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">, e):</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #c1651c" class="">p</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = QPainter(</span><span style="font-variant-ligatures: no-common-ligatures; color: #c200ff" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="1" class=""> p.setBrush(Qt.red)</font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> p.drawRect(</span><span style="font-variant-ligatures: no-common-ligatures; color: #c200ff" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">.rect())</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(242, 242, 242); background-color: rgb(0, 0, 0); min-height: 16px;" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c1651c" class="">app</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = QApplication(sys.argv)</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c1651c" class="">mw</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = QMainWindow()</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c1651c" class="">w</span><span style="font-variant-ligatures: no-common-ligatures" class=""> = Widget()</span></font></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="1" class="">mw.setCentralWidget(w)</font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="1" class="">mw.show()</font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><font size="1" class="">w.show()</font></span></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Monaco; color: rgb(218, 218, 218); background-color: rgb(0, 0, 0);" class=""><font size="1" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">app.</span><span style="font-variant-ligatures: no-common-ligatures; color: #c200ff" class="">exec</span><span style="font-variant-ligatures: no-common-ligatures" class="">()</span></font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The following 1-to-1 C++ translation shows no such behavior:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><!--StartFragment-->#<span style="color: rgb(0, 0, 128);" class="">include</span><span style="color: rgb(192, 192, 192);" class=""> </span><<span style="color: rgb(0, 128, 0);" class="">QApplication</span>></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">#<span style=" color:#000080;" class="">include</span><span style=" color:#c0c0c0;" class=""> </span><<span style=" color:#008000;" class="">QMainWindow</span>></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">#<span style=" color:#000080;" class="">include</span><span style=" color:#c0c0c0;" class=""> </span><<span style=" color:#008000;" class="">QWidget</span>></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">#<span style=" color:#000080;" class="">include</span><span style=" color:#c0c0c0;" class=""> </span><<span style=" color:#008000;" class="">QPainter</span>></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#808000;" class="">class</span><span style=" color:#c0c0c0;" class=""> </span><span style=" font-weight:600; color:#800080;" class="">Widget</span><span style=" color:#c0c0c0;" class=""> </span>:<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">public</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">QWidget</span><span style=" color:#c0c0c0;" class=""> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#808000;" class="">public</span>:</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">void</span><span style=" color:#c0c0c0;" class=""> </span><span style=" font-weight:600; font-style:italic; color:#00677c;" class="">paintEvent</span>(<span style=" color:#800080;" class="">QPaintEvent</span><span style=" color:#c0c0c0;" class=""> </span>*)<span style=" color:#c0c0c0;" class=""> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">QPainter</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">p</span>(<span style=" color:#808000;" class="">this</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">p</span>.<span style=" color:#00677c;" class="">setBrush</span>(<span style=" color:#800080;" class="">Qt</span>::<span style=" color:#800080;" class="">red</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">p</span>.<span style=" color:#00677c;" class="">drawRect</span>(<span style=" color:#00677c;" class="">rect</span>());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">};</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#808000;" class="">int</span><span style=" color:#c0c0c0;" class=""> </span><span style=" font-weight:600; color:#00677c;" class="">main</span>(<span style=" color:#808000;" class="">int</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">argc</span>,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">char</span><span style=" color:#c0c0c0;" class=""> </span>*<span style=" color:#092e64;" class="">argv</span>[])</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">QApplication</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">a</span>(<span style=" font-style:italic; color:#092e64;" class="">argc</span>,<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">argv</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">QMainWindow</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">mw</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">QWidget</span><span style=" color:#c0c0c0;" class=""> </span>*<span style=" color:#092e64;" class="">w</span><span style=" color:#c0c0c0;" class=""> </span>=<span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">new</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#800080;" class="">Widget</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">mw</span>.<span style=" color:#00677c;" class="">setCentralWidget</span>(<span style=" color:#092e64;" class="">w</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">mw</span>.<span style=" color:#00677c;" class="">show</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#808000;" class="">return</span><span style=" color:#c0c0c0;" class=""> </span><span style=" color:#092e64;" class="">a</span>.<span style=" color:#00677c;" class="">exec</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class="">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""><!--EndFragment--></pre><div class=""><br class=""></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div>_______________________________________________<br class="">PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" class="">PyQt@riverbankcomputing.com</a><br class=""><a href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt" class="">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div><br class=""></div></div></body></html>