tags:

views:

38

answers:

1

Hi all I have to do a little script in Python. In this script I have a variable (that represents a coordinate) that is continuously updated to a new value. So I have to draw a red point over a image and update the point position every time the variable that contains the coordinate is updated.

I tried to explain what I need doing something like this but obviously it doesn't works:

import Tkinter, Image, ImageDraw, ImageTk

i=0
root = Tkinter.Tk()
im = Image.open("img.jpg")
root.geometry("%dx%d" % (im.size[0], im.size[1]))

while True:
    draw = ImageDraw.Draw(im)
    draw.ellipse((i, 0, 10, 10), fill=(255, 0, 0))
    pi = ImageTk.PhotoImage(im)
    label = Tkinter.Label(root, image=pi)
    label.place(x=0, y=0, width=im.size[0], height=im.size[1])
    i+=1

del draw

someone may help me please? thanks very much!

+1  A: 

Your on the right track using a PhotoImage in a Label but instead of creating a new Label each loop, just create the label once and update its position in the loop.

Damian Kennedy