Issue 28264: Turtle.onclick events blocked by Turtle.stamp (original) (raw)

Created on 2016-09-24 02:36 by George Fagin, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
click_and_stamp.py George Fagin,2016-09-24 02:36 Sample Python 3 program demonstrating the problem
Messages (5)
msg277306 - (view) Author: George Fagin (George Fagin) Date: 2016-09-24 02:36
After a Turtle.stamp() command, turtle click notifications enabled via Turtle.onclick() are blocked until subsequent turtle commands are issued. Examples of the functions that re-enable click notifications include undo(), fd(0), left(0), etc. I've verified this behavior on both Python 3.4.2 (my Raspberry Pi) and Python 3.4.4 (my Windows 7 laptop). The attached sample code demonstrates that it's not difficult to work around the issue by using one of those functions immediately after any Turtle.click(), but I'd think that should be handled by the library to it's transparent to the user.
msg277767 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-09-30 18:36
3.4 only gets security patches. I cannot reproduce in 3.5.2 or 3.6.0b1 on Win 10. Left click always moves the turtle whether or not stamp is activated. Until problem is verified in a current release, we will have to assume it has been fixed by a turtle or tkinter patch in 3.5.
msg277929 - (view) Author: George Fagin (George Fagin) Date: 2016-10-03 05:34
When you say "left click always moves the turtle" I fear my explanation was not clear enough. A left click always moves the turtle in my version as well. What changes when stamp is activated is that OnClick events are not issued when you click on the turtle.
msg277933 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-10-03 07:05
I understand now, you mean the printing of '************* turtle click detected *************' is suppressed by turning stamping on. It is slightly confusing that the effect of clicking the stamp box, to disable or re-enable, does not happen until after the next left click. If I check the box, click a turtle, it spins, uncheck the box, click a turtle, and it does not spin. It takes at least two clicks to see the effect. Anyway, verified on Win10 with 3.6.0b1.
msg278096 - (view) Author: George Fagin (George Fagin) Date: 2016-10-05 00:10
Now you've got it. Clicking on the turtle results in an event message - at which point I spin the turtle and issue the message to make it clear that the message arrived. However, if you try doing that after a 'Turtle.stamp()' the message never comes. Issuing any of the other commands with the buttons will address the problem. This is why I think it's related to z-order: by doing something else the turtle gets focus again, and the OnClick event messages resume (until the next stamp). Thanks for taking time to look at this - I do appreciate it.
History
Date User Action Args
2022-04-11 14:58:37 admin set github: 72451
2016-10-05 00:10:34 George Fagin set messages: +
2016-10-03 07:05:33 terry.reedy set stage: test neededmessages: + versions: + Python 3.5, Python 3.6, Python 3.7, - Python 3.4
2016-10-03 05:34:11 George Fagin set messages: +
2016-09-30 18:36:14 terry.reedy set nosy: + terry.reedymessages: + title: Python 3.4.4 Turtle library - Turtle.onclick events blocked by Turtle.stamp -> Turtle.onclick events blocked by Turtle.stamp
2016-09-24 02:36:40 George Fagin create