(no subject)

Vasilis Vlachoudis <[email protected]> Wed, 4 Mar 2020 15:33:07 +0000
Newsgroups gmane.comp.python.tkinter
Message-ID <[email protected]>
--===============8110466822447110121==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_0BC70B5D93E054469872FFD0FE07220E02E64F72B8CERNXCHG51cer_"

--_000_0BC70B5D93E054469872FFD0FE07220E02E64F72B8CERNXCHG51cer_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I had the impression that tkinter is single threaded, but it seems that the=
 breakpoint() or input()
does not block the mainloop to continue
If one clicks the second button that waits for an input or enter in the bre=
akpoint()
the mainloop is still responsive while it waits for an input. So one can cl=
ick any button
the first to display the message or the second that will abort with a messa=
ge that readline cannot
be re-entered?

Why is that? What other commands can trigger such a behavior?

import tkinter as tk

def boinc():
for i in range(10):
print("boinc...")

def debug():
#breakpoint()
print("Breakpoint")
print("Input: ",end=3D"")
s =3D input()
print("Entered:", s)

#--------------------------------------------------------------------------=
-----
if __name__ =3D=3D "__main__":
root =3D tk.Tk()
b =3D tk.Button(root, text=3D"Boinc", command=3Dboinc)
b.pack()
b =3D tk.Button(root, text=3D"Debug", command=3Ddebug)
b.pack()
root.mainloop()

--_000_0BC70B5D93E054469872FFD0FE07220E02E64F72B8CERNXCHG51cer_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html dir=3D"ltr">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style>#cVim-command-bar, #cVim-command-bar-mode, #cVim-command-bar-input, =
#cVim-command-bar-search-results,=0A=
.cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-i=
tem .cVim-left,=0A=
.cVim-completion-item .cVim-right {=0A=
  font-family: Helvetica, Helvetica Neue, Neue, sans-serif, monospace, Aria=
l;=0A=
  font-size: 10pt !important;=0A=
  -webkit-font-smoothing: antialiased !important;=0A=
}=0A=
=0A=
#cVim-command-bar {=0A=
  position: fixed;=0A=
  z-index: 2147483646;=0A=
  background-color: #1b1d1e;=0A=
  color: #bbb;=0A=
  display: none;=0A=
  box-sizing: content-box;=0A=
  box-shadow: 0 3px 3px rgba(0,0,0,0.4);=0A=
  left: 0;=0A=
  width: 100%;=0A=
  height: 20px;=0A=
}=0A=
=0A=
#cVim-command-bar-mode {=0A=
  display: inline-block;=0A=
  vertical-align: middle;=0A=
  box-sizing: border-box;=0A=
  padding-left: 2px;=0A=
  height: 100%;=0A=
  width: 10px;=0A=
  padding-top: 2px;=0A=
  color: #888;=0A=
}=0A=
=0A=
#cVim-command-bar-input {=0A=
  background-color: #1b1d1e;=0A=
  color: #bbb;=0A=
  height: 100%;=0A=
  right: 0;=0A=
  top: 0;=0A=
  width: calc(100% - 10px);=0A=
  position: absolute;=0A=
}=0A=
=0A=
#cVim-command-bar-search-results {=0A=
  position: fixed;=0A=
  width: 100%;=0A=
  overflow: hidden;=0A=
  z-index: 2147483647;=0A=
  left: 0;=0A=
  box-shadow: 0 3px 3px rgba(0,0,0,0.4);=0A=
  background-color: #1c1c1c;=0A=
}=0A=
=0A=
.cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-i=
tem .cVim-left, .cVim-completion-item .cVim-right {=0A=
  text-overflow: ellipsis;=0A=
  padding: 1px;=0A=
  display: inline-block;=0A=
  box-sizing: border-box;=0A=
  vertical-align: middle;=0A=
  overflow: hidden;=0A=
  white-space: nowrap;=0A=
}=0A=
=0A=
.cVim-completion-item:nth-child(even) {=0A=
  background-color: #1f1f1f;=0A=
}=0A=
=0A=
.cVim-completion-item {=0A=
  width: 100%; left: 0;=0A=
  color: #bcbcbc;=0A=
}=0A=
=0A=
.cVim-completion-item[active] {=0A=
  width: 100%; left: 0;=0A=
  color: #1b1d1e;=0A=
  background-color: #f1f1f1;=0A=
}=0A=
=0A=
.cVim-completion-item[active] span {=0A=
  color: #1b1d1e;=0A=
}=0A=
=0A=
.cVim-completion-item .cVim-left {=0A=
  color: #fff;=0A=
  width: 37%;=0A=
}=0A=
=0A=
.cVim-completion-item .cVim-right {=0A=
  font-style: italic;=0A=
  color: #888;=0A=
  width: 57%;=0A=
}=0A=
=0A=
=0A=
#cVim-link-container, .cVim-link-hint,=0A=
#cVim-hud, #cVim-status-bar {=0A=
  font-family: Helvetica, Helvetica Neue, Neue, sans-serif, monospace, Aria=
l;=0A=
  font-size: 10pt !important;=0A=
  -webkit-font-smoothing: antialiased !important;=0A=
}=0A=
=0A=
#cVim-link-container {=0A=
  position: absolute;=0A=
  pointer-events: none;=0A=
  width: 100%; left: 0;=0A=
  height: 100%; top: 0;=0A=
  z-index: 2147483647;=0A=
}=0A=
=0A=
.cVim-link-hint {=0A=
  position: absolute;=0A=
  color: #302505 !important;=0A=
  background-color: #ffd76e !important;=0A=
  border-radius: 2px !important;=0A=
  padding: 2px !important;=0A=
  font-size: 8pt !important;=0A=
  font-weight: 500 !important;=0A=
  text-transform: uppercase !important;=0A=
  border: 1px solid #ad810c;=0A=
  display: inline-block !important;=0A=
  vertical-align: middle !important;=0A=
  text-align: center !important;=0A=
  box-shadow: 2px 2px 1px rgba(0,0,0,0.25) !important;=0A=
}=0A=
=0A=
.cVim-link-hint_match {=0A=
  color: #777;=0A=
  text-transform: uppercase !important;=0A=
}=0A=
=0A=
=0A=
#cVim-hud {=0A=
  background-color: rgba(28,28,28,0.9);=0A=
  position: fixed !important;=0A=
  transition: right 0.2s ease-out;=0A=
  z-index: 24724289;=0A=
}=0A=
=0A=
#cVim-hud span {=0A=
  padding: 2px;=0A=
  padding-left: 4px;=0A=
  padding-right: 4px;=0A=
  color: #8f8f8f;=0A=
  font-size: 10pt;=0A=
}=0A=
=0A=
#cVim-frames-outline {=0A=
  position: fixed;=0A=
  width: 100%;=0A=
  height: 100%;=0A=
  left: 0;=0A=
  top: 0;=0A=
  right: 0;=0A=
  z-index: 9999999999;=0A=
  box-sizing: border-box;=0A=
  border: 3px solid yellow;=0A=
}=0A=
</style><style type=3D"text/css" id=3D"owaParaStyle"></style>
</head>
<body fpstyle=3D"1" ocsi=3D"0">
<div style=3D"direction: ltr;font-family: Tahoma;color: #000000;font-size: =
10pt;">I had the impression that tkinter is single threaded, but it seems t=
hat the breakpoint() or input()
<div>does not block the mainloop to continue<br>
<div>If one clicks the second button that waits for an input or enter in th=
e breakpoint()</div>
<div>the mainloop is still responsive while it waits for an input. So one c=
an click any button</div>
<div>the first to display the message or the second that will abort with a =
message that readline cannot</div>
<div>be re-entered?</div>
<div><br>
</div>
<div>Why is that? What other commands can trigger such a behavior?</div>
<div><br>
</div>
<div>
<div><span style=3D"font-size: 13.3333px;">import tkinter as tk</span></div=
>
<div><span style=3D"font-size: 13.3333px;"><br>
</span></div>
<div><span style=3D"font-size: 13.3333px;">def boinc():</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>for i in range(10):</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>print(&quot;boinc...&quot;)</span></div>
<div><span style=3D"font-size: 13.3333px;"><br>
</span></div>
<div><span style=3D"font-size: 13.3333px;">def debug():</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>#breakpoint()</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>print(&quot;Breakpoint&quot;)</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>print(&quot;Input: &quot;,end=3D&quot;&quot;)</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>s =3D input()</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>print(&quot;Entered:&quot;, s)</span></div>
<div><span style=3D"font-size: 13.3333px;"><br>
</span></div>
<div><span style=3D"font-size: 13.3333px;">#-------------------------------=
------------------------------------------------</span></div>
<div><span style=3D"font-size: 13.3333px;">if __name__ =3D=3D &quot;__main_=
_&quot;:</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>root =3D tk.Tk()</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>b =3D tk.Button(root, text=3D&quot;Boinc&quot;, command=3Dboinc)</sp=
an></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>b.pack()</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>b =3D tk.Button(root, text=3D&quot;Debug&quot;, command=3Ddebug)</sp=
an></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>b.pack()</span></div>
<div><span style=3D"font-size: 13.3333px;"><span style=3D"white-space:pre">=
</span>root.mainloop()</span></div>
</div>
</div>
</div>
</body>
</html>

--_000_0BC70B5D93E054469872FFD0FE07220E02E64F72B8CERNXCHG51cer_--

--===============8110466822447110121==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tkinter-discuss mailing list
[email protected]
https://mail.python.org/mailman/listinfo/tkinter-discuss

--===============8110466822447110121==--