я хочу что бы программа после нажатия на turtle мне зачитывали Переменную 'points'.
но я не могу разобраться в чём ошибка.
Помогите пожалуйста вот код:
но я не могу разобраться в чём ошибка.
Помогите пожалуйста вот код:
Код:
from turtle import*
from random import randint
w = 200
h = 200
points = 0
t1 =Turtle()
t1.color('red')
t1.shape('square')
t1.speed(9999)
t1.penup()
t1.goto(randint(-w,w),randint(-h,h))
def catch1(x,y):
t1.goto(500, 500)
global points
points=points+1
t1.onclick(catch1)
t2 =Turtle()
t2.color('red')
t2.shape('square')
t2.speed(9999)
t2.penup()
t2.goto(randint(-w,w),randint(-h,h))
def catch1(x,y):
t2.goto(500, 500)
global points
points=points+1
t2.onclick(catch1)
t3 =Turtle()
t3.color('red')
t3.shape('square')
t3.speed(9999)
t3.penup()
t3.goto(randint(-w,w),randint(-h,h))
def catch1(x,y):
t3.goto(500, 500)
global points
points=points+1
t3.onclick(catch1)
t4 =Turtle()
t4.color('red')
t4.shape('square')
t4.speed(9999)
t4.penup()
t4.goto(randint(-w,w),randint(-h,h))
def catch1(x,y):
t4.goto(500, 500)
global points
points=points+1
t4.onclick(catch1)
t5 =Turtle()
t5.color('red')
t5.shape('square')
t5.speed(9999)
t5.penup()
t5.goto(randint(-w,w),randint(-h,h))
t5.onclick(catch1)
def catch1(x,y):
t5.goto(500, 500)
global points
points=points+1
t5.onclick(catch1)
if points == 5:
print('asfsd')
exitonclick()
Последнее редактирование: