Re: Widgets are not updated - is this a bug?
Raymond Osborn <[email protected]> Thu, 25 Jun 2020 11:04:42 -0500
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_112A5663-82B7-47E6-857F-E04835333F2D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
It=E2=80=99s mainly the setText functions for QLabel and QLineEdit, =
e.g.,=20
class NXLabel(QtWidgets.QLabel):
"""A text label.
=20
This is being subclassed from the PyQt QLabel class because of a bug =
in
recent versions of PyQt5 (>11) that requires the box to be repainted=20=
after any programmatic changes.
"""
def setText(self, text):
"""Function to set the text in the box.
Parameters
----------
text : str
Text to replace the text box contents.
"""
super(NXLabel, self).setText(str(text))
self.repaint()
I also added a repaint to the setValue function of QSpinBox and =
QDoubleSpinBox. I presume they had also given problems, but it might =
have been a precaution.=20
class NXSpinBox(QtWidgets.QSpinBox):
def setValue(self, value):
super(NXSpinBox, self).setValue(value)
self.repaint()
It doesn=E2=80=99t look as if it affected QTextEdit for some reason, but =
there may be others that I don=E2=80=99t use.=20
Ray
> On Jun 25, 2020, at 10:36 AM, Christian ARNAUD <[email protected]> =
wrote:
>=20
> Hi Raymond,
> =20
> Thank you for your quick answers.
> Would it be possible to share how do you subclass the concerned =
widgets? Is there a specific method that should be overloaded to trigger =
the repaint event?
> =20
> Christian
> =20
> =20
> De : Raymond Osborn <[email protected]>
> Date : jeudi 25 juin 2020 =C3=A0 15:41
> =C3=80 : PyQt mailing list <[email protected]>
> Cc : Christian ARNAUD <[email protected]>
> Objet : Re: Widgets are not updated - is this a bug?
> =20
> This is a bug that has been an issue since around v5.10 but which only =
affects Macs as far as I know. In my own code, I have had to subclass =
virtually every widget whose contents I change programmatically in order =
to add a call to repaint each time. Since I need my code to be =
compatible with multiplePyQt versions, I will have to leave it in even =
if it is fixed.
> =20
> Ray
>=20
>=20
>> From: Christian ARNAUD <[email protected] <mailto:[email protected]>>
>> Subject: Widgets are not updated - is this a bug?
>> Date: June 25, 2020 at 1:46:21 AM CDT
>> To: <[email protected] =
<mailto:[email protected]>>
>>=20
>>=20
>> Hi,
>> =20
>> I ran in a strange behavior where widgets in the view aren=E2=80=99t =
properly refreshed on change.
>> Here is the code, developed to show the problem:
>> =20
>> import sys
>>=20
>> from PyQt5 import QtWidgets
>> from PyQt5.QtCore import Qt
>>=20
>>=20
>> class MainWindow(QtWidgets.QMainWindow):
>> def __init__(self):
>> QtWidgets.QMainWindow.__init__(self)
>> self.resize(250, 100)
>> self.setWindowTitle("Demo")
>> self.centralWidget =3D QtWidgets.QWidget(self)
>> self.formlayout =3D QtWidgets.QFormLayout(self.centralWidget)
>> self.label1 =3D QtWidgets.QLabel('Text 1', =
self.centralWidget)
>> self.ledit1 =3D QtWidgets.QLineEdit('initial value', =
self.centralWidget)
>> self.bproceed =3D QtWidgets.QPushButton('Proceed', =
self.centralWidget)
>> self.bproceed.setDefault(True)
>> self.bproceed.setFocusPolicy(Qt.StrongFocus)
>> self.formlayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, =
self.label1)
>> self.formlayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, =
self.ledit1)
>> self.formlayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, =
self.bproceed)
>> self.setCentralWidget(self.centralWidget)
>>=20
>> self.bproceed.clicked.connect(self.on_clicked)
>>=20
>> def on_clicked(self):
>> self.ledit1.setText('')
>>=20
>>=20
>> if __name__ =3D=3D "__main__":
>> app =3D QtWidgets.QApplication(sys.argv)
>> win =3D MainWindow()
>> win.show()
>> sys.exit(app.exec())
>> =20
>> =20
>> If the pushbutton is clicked with the mouse or with the space key =
(after getting the focus with Tab), the text in the lineedit is not =
refreshed. If a repaint is forced, it is.
>> If the pushbutton is clicked with the enter key (after getting the =
focus with Tab), the text in the lineedit is correctly refreshed.
>> =20
>> Any idea?
>> =20
>> My env:
>> OSX Catalina 10.15.5
>> Python 3.6
>> PyQt: 15.0
>> =20
>> Thank you
>>=20
>>=20
>> _______________________________________________
>> PyQt mailing list
>> [email protected] <mailto:[email protected]>
>> https://www.riverbankcomputing.com/mailman/listinfo/pyqt =
<https://www.riverbankcomputing.com/mailman/listinfo/pyqt>
--Apple-Mail=_112A5663-82B7-47E6-857F-E04835333F2D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=utf-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" =
class=3D"">It=E2=80=99s mainly the setText functions for QLabel and =
QLineEdit, e.g., <div class=3D""><br class=3D""></div><div =
class=3D"">class NXLabel(QtWidgets.QLabel):<br class=3D""> =
"""A text label.<br class=3D""> <br class=3D""> =
This is being subclassed from the PyQt QLabel class because of a =
bug in<br class=3D""> recent versions of PyQt5 (>11) =
that requires the box to be repainted <br class=3D""> =
after any programmatic changes.<br class=3D""> """<br =
class=3D""><br class=3D""> def setText(self, text):<br =
class=3D""> """Function to set the text in =
the box.<br class=3D""><br class=3D""> =
Parameters<br class=3D""> ----------<br =
class=3D""> text : str<br class=3D""> =
Text to replace the text box =
contents.<br class=3D""> """<br =
class=3D""> super(NXLabel, =
self).setText(str(text))<br class=3D""> =
self.repaint()</div><div class=3D""><br class=3D""></div><div class=3D"">I=
also added a repaint to the setValue function of QSpinBox and =
QDoubleSpinBox. I presume they had also given problems, but it might =
have been a precaution. </div><div class=3D""><br =
class=3D""></div><div class=3D""><div class=3D"">class =
NXSpinBox(QtWidgets.QSpinBox):</div><div class=3D""><br =
class=3D""></div><div class=3D""> def setValue(self, =
value):</div><div class=3D""> =
super(NXSpinBox, self).setValue(value)</div><div class=3D""> =
self.repaint()</div><div class=3D""><br =
class=3D""></div><div class=3D"">It doesn=E2=80=99t look as if it =
affected QTextEdit for some reason, but there may be others that I =
don=E2=80=99t use. </div><div class=3D""><br class=3D""></div>Ray<br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Jun 25, 2020, at 10:36 AM, Christian ARNAUD <<a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>> wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><div =
class=3D"WordSection1" style=3D"page: WordSection1; caret-color: rgb(0, =
0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: normal; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><div style=3D"margin: 0cm 0cm 0.0001pt; =
font-size: 11pt; font-family: Calibri, sans-serif;" class=3D""><span =
class=3D"">Hi Raymond,<o:p class=3D""></o:p></span></div><div =
style=3D"margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><span class=3D""><o:p =
class=3D""> </o:p></span></div><div style=3D"margin: 0cm 0cm =
0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" =
class=3D""><span lang=3D"EN-US" class=3D"">Thank you for your quick =
answers.<o:p class=3D""></o:p></span></div><div style=3D"margin: 0cm 0cm =
0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" =
class=3D""><span lang=3D"EN-US" class=3D"">Would it be possible to share =
how do you subclass the concerned widgets? Is there a specific method =
that should be overloaded to trigger the repaint event?<o:p =
class=3D""></o:p></span></div><div style=3D"margin: 0cm 0cm 0.0001pt; =
font-size: 11pt; font-family: Calibri, sans-serif;" class=3D""><span =
lang=3D"EN-US" class=3D""><o:p class=3D""> </o:p></span></div><div =
style=3D"margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><span lang=3D"EN-US" =
class=3D"">Christian<o:p class=3D""></o:p></span></div><div =
style=3D"margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><span lang=3D"EN-US" class=3D""><o:p =
class=3D""> </o:p></span></div><div style=3D"margin: 0cm 0cm =
0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" =
class=3D""><span lang=3D"EN-US" class=3D""><o:p =
class=3D""> </o:p></span></div><div style=3D"border-style: solid =
none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); =
padding: 3pt 0cm 0cm;" class=3D""><div style=3D"margin: 0cm 0cm 0.0001pt =
35.4pt; font-size: 11pt; font-family: Calibri, sans-serif;" class=3D""><b =
class=3D""><span style=3D"font-size: 12pt;" class=3D"">De :<span =
class=3D"Apple-converted-space"> </span></span></b><span =
style=3D"font-size: 12pt;" class=3D"">Raymond Osborn <<a =
href=3D"mailto:[email protected]" class=3D"">[email protected]</a>><br =
class=3D""><b class=3D"">Date :<span =
class=3D"Apple-converted-space"> </span></b>jeudi 25 juin 2020 =C3=A0=
15:41<br class=3D""><b class=3D"">=C3=80 :<span =
class=3D"Apple-converted-space"> </span></b>PyQt mailing list =
<<a href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>><br class=3D""><b =
class=3D"">Cc :<span =
class=3D"Apple-converted-space"> </span></b>Christian ARNAUD <<a =
href=3D"mailto:[email protected]" class=3D"">[email protected]</a>><br =
class=3D""><b class=3D"">Objet :<span =
class=3D"Apple-converted-space"> </span></b>Re: Widgets are not =
updated - is this a bug?<o:p class=3D""></o:p></span></div></div><div =
class=3D""><div style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: =
11pt; font-family: Calibri, sans-serif;" class=3D""><o:p =
class=3D""> </o:p></div></div><div style=3D"margin: 0cm 0cm =
0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, sans-serif;" =
class=3D"">This is a bug that has been an issue since around v5.10 but =
which only affects Macs as far as I know. In my own code, I have had to =
subclass virtually every widget whose contents I change programmatically =
in order to add a call to repaint each time. Since I need my code to be =
compatible with multiplePyQt versions, I will have to leave it in even =
if it is fixed.<o:p class=3D""></o:p></div><div class=3D""><div =
style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><o:p =
class=3D""> </o:p></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D"">Ray<o:p class=3D""></o:p></div><div =
class=3D""><div style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: =
11pt; font-family: Calibri, sans-serif;" class=3D""><br class=3D""><br =
class=3D""><o:p class=3D""></o:p></div><blockquote style=3D"margin-top: =
5pt; margin-bottom: 5pt;" class=3D"" type=3D"cite"><div class=3D""><div =
style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><b class=3D""><span style=3D"font-family:=
"Helvetica Neue"; color: rgb(127, 127, 127);" =
class=3D"">From: </span></b><span style=3D"font-family: =
"Helvetica Neue";" class=3D"">Christian ARNAUD <<a =
href=3D"mailto:[email protected]" style=3D"color: blue; text-decoration: =
underline;" class=3D"">[email protected]</a>></span><o:p =
class=3D""></o:p></div></div><div class=3D""><div class=3D""><div =
style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><b class=3D""><span style=3D"font-size: =
9pt; font-family: "Helvetica Neue"; color: rgb(127, 127, =
127);" class=3D"">Subject:<span =
class=3D"apple-converted-space"> </span></span></b><b =
class=3D""><span style=3D"font-size: 9pt; font-family: "Helvetica =
Neue";" class=3D"">Widgets are not updated - is this a =
bug?</span></b><span style=3D"font-size: 9pt; font-family: Helvetica;" =
class=3D""><o:p class=3D""></o:p></span></div></div><div class=3D""><div =
style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><b class=3D""><span style=3D"font-size: =
9pt; font-family: "Helvetica Neue"; color: rgb(127, 127, =
127);" class=3D"">Date:<span =
class=3D"apple-converted-space"> </span></span></b><span =
style=3D"font-size: 9pt; font-family: "Helvetica Neue";" =
class=3D"">June 25, 2020 at 1:46:21 AM CDT</span><span style=3D"font-size:=
9pt; font-family: Helvetica;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><b class=3D""><span style=3D"font-size: 9pt; =
font-family: "Helvetica Neue"; color: rgb(127, 127, 127);" =
class=3D"">To:<span =
class=3D"apple-converted-space"> </span></span></b><span =
style=3D"font-size: 9pt; font-family: "Helvetica Neue";" =
class=3D""><<a href=3D"mailto:[email protected]" =
style=3D"color: blue; text-decoration: underline;" =
class=3D"">[email protected]</a>></span><span =
style=3D"font-size: 9pt; font-family: Helvetica;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div style=3D"margin: 0cm 0cm =
0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, sans-serif;" =
class=3D""><span style=3D"font-size: 9pt; font-family: Helvetica;" =
class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-variant-caps: =
normal; text-align: start; -webkit-text-stroke-width: 0px; word-spacing: =
0px;" class=3D""><br class=3D""></span><o:p class=3D""></o:p></div><div =
class=3D""><div style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: =
11pt; font-family: Calibri, sans-serif;" class=3D"">Hi,<span =
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""> <span style=3D"font-size: 12pt;" =
class=3D""><o:p class=3D""></o:p></span></div></div><div class=3D""><div =
style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">I ran =
in a strange behavior where widgets in the view aren=E2=80=99t properly =
refreshed on change.</span><span style=3D"font-size: 12pt;" =
class=3D""><o:p class=3D""></o:p></span></div></div><div class=3D""><div =
style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">Here is =
the code, developed to show the problem:</span><span style=3D"font-size: =
12pt;" class=3D""><o:p class=3D""></o:p></span></div></div><div =
class=3D""><div style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: =
11pt; font-family: Calibri, sans-serif;" class=3D""><span lang=3D"EN-US" =
class=3D""> </span><span style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif; background-color: white;" class=3D""><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(0, 51, 179);" class=3D"">import<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">sys<br class=3D""><br class=3D""></span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(0, 51, 179);" class=3D"">from<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">PyQt5<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(0, 51, 179);" class=3D"">import<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">QtWidgets<br class=3D""></span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(0, 51, 179);" class=3D"">from<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">PyQt5.QtCore<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(0, 51, 179);" class=3D"">import<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">Qt<br class=3D""><br class=3D""><br =
class=3D""></span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(0, 51, 179);" =
class=3D"">class<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New";" =
class=3D"">MainWindow</span><span lang=3D"EN-US" style=3D"font-size: =
10pt; font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">(QtWidgets.QMainWindow):<br class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(0, 51, 179);" class=3D"">def<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(178, 0, 178);" class=3D"">__init__</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">(</span><span lang=3D"EN-US" style=3D"font-size:=
10pt; font-family: "Courier New"; color: rgb(148, 85, 141);" =
class=3D"">self</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">):<br class=3D""> =
QtWidgets.QMainWindow.</span><span lang=3D"EN-US" style=3D"font-size: =
10pt; font-family: "Courier New"; color: rgb(178, 0, 178);" =
class=3D"">__init__</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">(</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(148, 85, 141);" =
class=3D"">self</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">)<br class=3D""> <span=
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.resize(</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(23, 80, 235);" class=3D"">250</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">,<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(23, 80, 235);" class=3D"">100</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.setWindowTitle(</span><b class=3D""><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: teal;" class=3D"">"Demo"</span></b><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.centralWidget =3D =
QtWidgets.QWidget(</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(148, 85, 141);" =
class=3D"">self</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">)<br class=3D""> <span=
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.formlayout =3D =
QtWidgets.QFormLayout(</span><span lang=3D"EN-US" style=3D"font-size: =
10pt; font-family: "Courier New"; color: rgb(148, 85, 141);" =
class=3D"">self</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">.centralWidget)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.label1 =3D QtWidgets.QLabel(</span><b =
class=3D""><span lang=3D"EN-US" style=3D"font-size: 10pt; font-family: =
"Courier New"; color: teal;" class=3D"">'Text =
1'</span></b><span lang=3D"EN-US" style=3D"font-size: 10pt; font-family: =
"Courier New"; color: rgb(8, 8, 8);" class=3D"">,<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.centralWidget)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.ledit1 =3D QtWidgets.QLineEdit(</span><b =
class=3D""><span lang=3D"EN-US" style=3D"font-size: 10pt; font-family: =
"Courier New"; color: teal;" class=3D"">'initial =
value'</span></b><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">,<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.centralWidget)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.bproceed =3D QtWidgets.QPushButton(</span><b =
class=3D""><span lang=3D"EN-US" style=3D"font-size: 10pt; font-family: =
"Courier New"; color: teal;" =
class=3D"">'Proceed'</span></b><span lang=3D"EN-US" style=3D"font-size: =
10pt; font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">,<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.centralWidget)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.bproceed.setDefault(</span><span lang=3D"EN-US"=
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(0, 51, 179);" class=3D"">True</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.bproceed.setFocusPolicy(Qt.StrongFocus)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.formlayout.setWidget(</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(23, 80, 235);" class=3D"">1</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(8, 8, 8);" class=3D"">, =
QtWidgets.QFormLayout.LabelRole,<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.label1)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.formlayout.setWidget(</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(23, 80, 235);" class=3D"">1</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(8, 8, 8);" class=3D"">, =
QtWidgets.QFormLayout.FieldRole,<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.ledit1)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.formlayout.setWidget(</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(23, 80, 235);" class=3D"">2</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(8, 8, 8);" class=3D"">, =
QtWidgets.QFormLayout.FieldRole,<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.bproceed)<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.setCentralWidget(</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.centralWidget)<br class=3D""><br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.bproceed.clicked.connect(</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(148, 85, 141);" class=3D"">self</span><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(8, 8, 8);" class=3D"">.on_clicked)<br class=3D""><br=
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(0, 51, 179);" class=3D"">def<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New";" =
class=3D"">on_clicked</span><span lang=3D"EN-US" style=3D"font-size: =
10pt; font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">(</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(148, 85, 141);" =
class=3D"">self</span><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(8, 8, 8);" =
class=3D"">):<br =
class=3D""> <span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(148, 85, 141);" class=3D"">self</span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">.ledit1.setText(</span><b class=3D""><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: teal;" class=3D"">''</span></b><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">)<br class=3D""></span><i class=3D""><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(140, 140, 140);" class=3D""><br class=3D""><br =
class=3D""></span></i><span lang=3D"EN-US" style=3D"font-size: 10pt; =
font-family: "Courier New"; color: rgb(0, 51, 179);" =
class=3D"">if<span =
class=3D"apple-converted-space"> </span></span><span lang=3D"EN-US" =
style=3D"font-size: 10pt; font-family: "Courier New"; color: =
rgb(8, 8, 8);" class=3D"">__name__ =3D=3D<span =
class=3D"apple-converted-space"> </span></span><b class=3D""><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: teal;" class=3D"">"__main__"</span></b><span =
lang=3D"EN-US" style=3D"font-size: 10pt; font-family: "Courier =
New"; color: rgb(8, 8, 8);" class=3D"">:<br =
class=3D""> app =3D =
QtWidgets.QApplication(sys.argv)<br class=3D""> win =3D =
MainWindow()<br class=3D""> win.show()<br =
class=3D""> sys.exit(app.exec())</span><span =
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D""> </span><span=
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D""> </span><span=
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">If the =
pushbutton is clicked with the mouse or with the space key (after =
getting the focus with Tab), the text in the lineedit is not refreshed. =
If a repaint is forced, it is.</span><span style=3D"font-size: 12pt;" =
class=3D""><o:p class=3D""></o:p></span></div></div><div class=3D""><div =
style=3D"margin: 0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: =
Calibri, sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">If the =
pushbutton is clicked with the enter key (after getting the focus with =
Tab), the text in the lineedit is correctly refreshed.</span><span =
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D""> </span><span=
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">Any =
idea?</span><span style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D""> </span><span=
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">My =
env:</span><span style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">OSX Catalina =
10.15.5</span><span style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">Python =
3.6</span><span style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">PyQt: =
15.0</span><span style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D""> </span><span=
style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div class=3D""><div style=3D"margin: =
0cm 0cm 0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, =
sans-serif;" class=3D""><span lang=3D"EN-US" class=3D"">Thank =
you</span><span style=3D"font-size: 12pt;" class=3D""><o:p =
class=3D""></o:p></span></div></div><div style=3D"margin: 0cm 0cm =
0.0001pt 35.4pt; font-size: 11pt; font-family: Calibri, sans-serif;" =
class=3D""><span style=3D"font-size: 9pt; font-family: Helvetica;" =
class=3D""><br class=3D""><br =
class=3D"">_______________________________________________<br =
class=3D"">PyQt mailing list<br class=3D""></span><a =
href=3D"mailto:[email protected]" style=3D"color: blue; =
text-decoration: underline;" class=3D""><span style=3D"font-size: 9pt; =
font-family: Helvetica;" =
class=3D"">[email protected]</span></a><span style=3D"font-size:=
9pt; font-family: Helvetica;" class=3D""><br class=3D""></span><a =
href=3D"https://www.riverbankcomputing.com/mailman/listinfo/pyqt" =
style=3D"color: blue; text-decoration: underline;" class=3D""><span =
style=3D"font-size: 9pt; font-family: Helvetica;" =
class=3D"">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</span>=
</a></div></div></blockquote></div></div></div></div></blockquote></div><b=
r class=3D""></div></body></html>=
--Apple-Mail=_112A5663-82B7-47E6-857F-E04835333F2D--