[Tkinter-discuss] Revisiting the adage of GUI thread
Nam Nguyen
namnguyen at google.com
Mon Mar 26 17:41:28 EDT 2018
On this note, is setting/getting variables (StringVar, IntVar etc)
considered GUI action? Why, or why not?
Thanks!
Nam
On Mon, Mar 26, 2018 at 2:22 PM, Michael Lange <klappnase at web.de> wrote:
> Hi,
>
> On Mon, 26 Mar 2018 12:54:20 -0700
> Nam Nguyen via Tkinter-discuss <tkinter-discuss at python.org> wrote:
>
> > This is where my confusion comes from, actually ;). Python is single
> > threaded (from the OS point of view). When I create the TCL
> > interpreter, it is also created in the same thread that runs the Python
> > interpreter. So regardless of how many Python threads (threading
> > module), they all should belong to this same OS thread, should they not?
>
> I am not an expert on this, but I don't think so. At least here when I
> run a Tkinter app using threads (on linux) I see three threads in top,
> each with a different pid.
> And I am quite sure that I have seen strange things happen, iirc seemingly
> unpredictable, when the rule of thumb "run Tk only from the main thread
> and don't touch it from any child thread" was not observed. Some times
> such code *seemed* to work though, which I believe makes it even more
> dangerous, since it seems you can never know what (and when) will hit you.
> So my recommendation is to just either stick with that "rule of thumb" or
> else try the aforementioned thread-safe tkinter version.
>
> Best regards
>
> Michael
>
> .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
>
> On my planet, to rest is to rest -- to cease using energy. To me, it
> is quite illogical to run up and down on green grass, using energy,
> instead of saving it.
> -- Spock, "Shore Leave", stardate 3025.2
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20180326/a06c9cae/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4849 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20180326/a06c9cae/attachment.bin>
More information about the Tkinter-discuss
mailing list