[New-bugs-announce] [issue16428] turtle with compound shape doesn't get clicks

pythonick report at bugs.python.org
Wed Nov 7 15:46:49 CET 2012


New submission from pythonick:

In the standard turtle module, when a turtle has a custom shape of type "compound", it doesn't to respond to click events. No problem with polygon shapes.

Observed on Windows XP, python 3.2.3, turtle version 1.1b, and on Linux, python 2.7. 

Test code:

##################################################
import turtle
square = ((0,0),(0,20),(20,20),(20,0))
turtle.addshape("sq1", square) # sq1 = polygon shape
s = turtle.Shape("compound")
s.addcomponent(square, "red")
turtle.addshape("sq2", s) # sq2 = compound shape
t1 = turtle.Turtle(shape="sq1")
t2 = turtle.Turtle(shape="sq2")
t2.fd(20)
def click(x,y): print("click at",x,y)
t1.onclick(click)
t2.onclick(click)
turtle.mainloop()
##################################################

When you click on the black square (i.e. t1), the message "click at..." is printed. When you click on the red square (i.e. t2), nothing happens.

----------
components: Library (Lib)
messages: 175106
nosy: pythonick
priority: normal
severity: normal
status: open
title: turtle with compound shape doesn't get clicks
type: behavior
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16428>
_______________________________________


More information about the New-bugs-announce mailing list