Johnston, please reply on-list. You have to either use "reply-all" or type "tutor@python.org" as a recipient, because messages aren't sent to tutor@python.org by default when you click "reply".
Thanks,
-Luke
--- Begin Message ---

That being said, you should still post your code, because there may be something that's causing the mouse events to be delayed for whatever reason.


Here are the relevant lines of code...

def draw_point(event):
    app.start_x = app.draw_area.canvasx(event.x)-app.brush_radius
    app.start_y = app.draw_area.canvasy(event.y)-app.brush_radius
    app.end_x = app.start_x+2*app.brush_radius
    app.end_y = app.start_y+2*app.brush_radius
drawing.append(app.draw_area.create_oval(app.start_x, app.start_y, app.end_x, app.end_y, fill=app.draw_color[1], outline=app.draw_color[1], width=0))
    print drawing

app.draw_area.bind("<B1-Motion>", draw_point)


So you'll have to interpolate a line between the two points and draw a series of ovals.

How would I go about doing this? The final result I'd like would be what Paint does, but I didn't know how to draw on the canvas while the left mouse button was being held. The closest I could get to this was binding the draw_point function to <B1-Motion>, and I don't see how I could know when the mouse was being dragged quickly.

Thanks, Johnston Jiaa


--- End Message ---
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to