Terry J. Reedy added the comment:
If I understand the test code, it creates the tk window in thread 0 (the main
thread), generates data in thread 1, sends data via a queue to thread 2, which
then inserts it into the Text widget. I ran a 3.x version up to 34000
iterations. When I comment out 'tk.mainloop()' or stop the mainloop with ^C,
thread 2 stops (reproducibly) with
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Programs\Python35\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "C:\Programs\Python35\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "F:\Python\mypy\tem.py", line 23, in QueueHandler
widinst.configure(state="normal")
File "C:\Programs\Python35\lib\tkinter\__init__.py", line 1330, in configure
return self._configure('configure', cnf, kw)
File "C:\Programs\Python35\lib\tkinter\__init__.py", line 1321, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
RuntimeError: main thread is not in main loop
I removed the spamming of Shell with 'running' and sped up the test code by
reducing the queued and inserted text to the iteration number and reran to
completion at 999999. I retract my statement about all widget access in
threads being unsupported. At least some seems to be at least in 3.x.
Running the original test code above in 2.7.11 from IDLE and console both fail
before 2000 iterations in my tries.
Sarbjit: I do not understand 'tkinter wizard'.
Serhiy: I am coming back to this after reading #11077. Do you have any idea
why this code runs in 3.x but eventually fails in 2.x? If there anything to
do, or just close?
----------
nosy: +serhiy.storchaka -gpolo, roger.serwy
Added file: http://bugs.python.org/file41966/tem.py
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16823>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com