Да сам ее так обозвал, она сама себя запускает, получается бесконечное воспроизводство, но не цикл, смотри код. Все ребята разобрался. Игра закончится по набору 20 баллов.
from tkinter import *
from random import randrange as rnd, choice
import time
root = Tk()
root.geometry('800x600')
root.title("Поймай шарик!")
canv = Canvas(root,width=800,height=550,bg='lightblue')
canv.pack()
colors = ['lightyellow','lightgray','gray','pink','violet','brown','red','orange','yellow','green','cyan','blue','magenta','black','gray','lightgreen']
x = 0
y = 0
r = 0
points = 0
miss = 0
zero = 0
def new_ball():
global x, y, r, zero, res, points
canv.delete(ALL)
res = canv.create_text(300,20,text="заработал " + str(points)+ " очков"
+'/'+"промазал "+str(miss)+" раз"+'/'+
"проворонил "+str(zero)+" шаров", font = 'Arial 15')
x = rnd(100,700)
y = rnd(100,500)
r = rnd(20,50)
target = canv.create_oval(x-r,y-r,x+r,y+r,fill = choice(colors), width=2)
if points < 20:
root.after(rnd(500, 3000),new_ball)
else:
canv.delete(ALL)
res = canv.create_text(350,250,text="Вы выйграли! Вы наколотили: " +
str(points)+ " балла(ов)", font = 'Arial 25')
zero+=1
def click(event):
global points, miss, zero, res, xz
if abs(x-event.x) < r/2 and abs(y-event.y)<r/2:
points += 2
zero-=1
elif abs(x-event.x) < r and abs(y-event.y)<r:
points += 1
zero-=1
else:
miss += 1
canv.delete(ALL)
res = canv.create_text(300,20,text="заработал " + str(points)+ " очков"
+'/'+"промазал "+str(miss)+" раз"+'/'+
"проворонил "+str(zero)+" шаров", font = 'Arial 15')
root.after(1000,new_ball)
canv.bind('<Button-1>',click)
mainloop()