import pygame,math,sys FPS = 60 pygame.init() sc=pygame.display.set_mode((600, 600)) clock = pygame.time.Clock() x,y=-1000,-1000 pygame.display.update() xes=[] yes=[] step=0 while step==0: try: if y==-2*x: xes.append(x) yes.append(y) x+=1 else: x+=1 if x>=1000: x=-1000 y+=1 if y>=1000: step=1 except ZeroDivisionError: x+=1 for i in range (len(xes)): print ('{'+str(xes[i])+', '+str(yes[i])+'}, ') while True: sc.fill('white') pygame.draw.line(sc,'black',(0,300),(600,300)) pygame.draw.line(sc,'black',(300,0),(300,600)) xm,ym=pygame.mouse.get_pos() for i in range (len(xes)): if yes[i]>0: pygame.draw.circle(sc,'red',(xes[i]+300,300-yes[i]),5) if yes[i]<0: pygame.draw.circle(sc,'blue',(xes[i]+300,abs(yes[i])+300),5) if yes[i]==0: pygame.draw.circle(sc,'purple',(xes[i]+300,abs(yes[i])+300),5) clock.tick(FPS) for i in pygame.event.get(): if i.type == pygame.QUIT: sys.exit() pygame.display.update()