Message260502
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? |
|
Date |
User |
Action |
Args |
2016-02-19 04:14:16 | terry.reedy | set | recipients:
+ terry.reedy, asvetlov, docs@python, serhiy.storchaka, Sarbjit.singh |
2016-02-19 04:14:16 | terry.reedy | set | messageid: <1455855256.46.0.501705176516.issue16823@psf.upfronthosting.co.za> |
2016-02-19 04:14:16 | terry.reedy | link | issue16823 messages |
2016-02-19 04:14:15 | terry.reedy | create | |
|