[issue16823] Python quits on running tkinter code with threads

2018-05-12 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
resolution:  -> duplicate

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16823] Python quits on running tkinter code with threads

2018-05-12 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In the message above, I asked "why this code runs in 3.x but eventually fails 
in 2.x?".  The answer is almost certainly that I used 3.5 with tk 8.6 compiled 
*with* thread support and 2.7 with tk 8.5 compiled without thread support.

Serhiy, if you use a system supplied 8.6 with thread support for all Python 
versions, that would explain why these thread examples work for you with all 
Python versions.  If non-thread tk works for you, then the code in _tkinter.c 
works better on Linux (where it must have been developed) than Windows.

The original failure report duplicates other similar reports.  My previous 
responses, including proposed doc change were incomplete, as I only learned 
about the tcl compile option a month ago.  I opened #33479, with more extensive 
proposed tkinter doc changes, in favor of this.

--
stage:  -> resolved
status: open -> closed
superseder:  -> Document tkinter and threads

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16823] Python quits on running tkinter code with threads

2016-02-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't know. I'm unable to reproduce the bug on Linux.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16823] Python quits on running tkinter code with threads

2016-02-18 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions: +Python 3.5 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16823] Python quits on running tkinter code with threads

2016-02-18 Thread Terry J. Reedy

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 99.  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16823] Python quits on running tkinter code with threads

2013-03-08 Thread Terry J. Reedy

Terry J. Reedy added the comment:

>From #11029: Doc about tkinter and treads should also give the alternative of 
>using queue.queue to feed data from multiple threads.
See msg127316

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16823] Python quits on running tkinter code with threads

2013-01-14 Thread Terry J. Reedy

Terry J. Reedy added the comment:

We use 'crash' to mean a segfault (and core dump, on *nix) or the Windows 
equivalent. We avoid those if at all possible. A Python traceback is not a 
crash but a semi-graceful shutdown that has be planned for, given the 
circumstances. What is annoying here is getting a different exception (or at 
least message type) each time. I presume it depends on what data gets 
corrupted, and that is somewhat haphazard. The quote seems to be accurate.

I know little about threading, but if it were possible to detect tkinter access 
from other than the main thread (without excessive slowdown), then a consistent 
exception might be raised. But I am doubtful that this can be done sensibly. 
Hence a doc change seems like the best first step.

--
title: Python crashes on running tkinter code with threads -> Python quits on 
running tkinter code with threads

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com