[Tutor] Button 1 Motion Event

Tiger12506 keridee at jayco.net
Wed Dec 5 02:29:51 CET 2007


>From your description, it sounds like the number of ovals placed depends 
only on when the B1-Motion even is sent to your Canvas object. If you want 
these a little more even, you might take the drawing code out of the 
function that's bound to the mouse event, so that whenever you process you a 
mouse event, for example, you append the appropriate information to a list, 
where it can be drawn all at once later. That will take the drawing time out 
of the equation, when it comes to how often the mouse event is called. At 
any rate, it is not likely to do you much good. Windows is allowed to 
process events such as WM_MOUSEMOVE whenever it's convenient for Windows. 
One way I can think of doing this (probably not the best way) is to start a 
timer on the mouse down message, and stop it on mouse up. Since the timer is 
sent messages rather evenly, you can poll the current mouse position in that 
function.

----- Original Message ----- 
From: "Johnston Jiaa" <oclbdk at gmail.com>
To: <tutor at python.org>
Sent: Tuesday, December 04, 2007 7:30 PM
Subject: [Tutor] Button 1 Motion Event


> I'm creating a drawing program, like MS Paint in Tkinter.  I bound
> the <B1-Motion> event to my Canvas object.  The function it's bound
> to creates an oval at the event's x and y attributes.
>
> This works fine if the user is dragging slowly, but if he does a
> sudden dragging motion, the ovals are very far apart.  Is there any
> way to fix this?
>
> Johnston Jiaa
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 



More information about the Tutor mailing list