Draw and move a point over an image in python

Posted by frx08 on Stack Overflow See other posts from Stack Overflow or by frx08
Published on 2010-05-27T11:48:33Z Indexed on 2010/05/27 11:51 UTC
Read the original article Hit count: 243

Filed under:

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!

© Stack Overflow or respective owner

Related posts about python