I am making a game in tkinter, and I was wondering if there was a proper way to make a game loop. With the current gameloop, whenever I update an object's position, It can be blurry. Here is my current gameloop:
self.running = True
while self.running:
for object1,object2,command,*args in coldetect:
self.detectcollision(object1,object2,command,*args)
self.canvas.delete('all')
for s in cubes:
s.draw()
self.root.update()
self.root.update_idletasks()
sleep(1/30)
where self.root
is an object of tkinter.Tk()
, and cubes
is a list of objects with the function draw()