import SimpleGUICS2Pygame.simpleguics2pygame as sp import random pos= [50,50] interval = 1000 image = sp._load_local_image(r"C:\Users\91997\Downloads\image-Wc38DALYJ-transformed.png") def input_handler1(msg): global image image = msg def tick(): x = random.randrange(0,500) y = random.randrange(0,500) pos[0] = x pos[1] = y def draw(canvas): canvas.draw_image(image,(image.get_width()/2,image.get_height()/2),(image.get_width(),image.get_height()),(pos), (image.get_width(),image.get_height())) frame = sp.create_frame("Key",500,500) timer = sp.create_timer(interval,tick) frame.set_draw_handler(draw) timer.start() frame.start()