the draw example unfortunately doesn't do line-drawing because on mouse-down, motion events always returns an empty list. this is on an amd64 system, debian/testing.
also tested on x86 system: same fault.
ok changed draw.py example to this, and despite events being empty, the example now works
events = self.win.window.get_motion_events(self.time, ev.time)
# Record the previous last coordinate, and append
# the new coordinates
firstline = len(self.lines) - 1
# Discard the first coordinate if that is identical to
# the last recorded coordinate
pos = events
if (pos.x, pos.y) == self.lines[-1]:
events = events[1:]
# Append all coordinates
for pos in events:
x = pos.x
This turns out to be a bug in the example programs: they should add a line to the MotionNotify event coordinate, even if get_motion_events() return no intermediate pointer positions. Fix for this checked into SVN now.
When these programs were written back in 2000, it seems that computers weren't fast enough to generate a MotionNotify event for each new coordinate and thus get_motion_events() always had some intermediate positions to return too. Nowadays there seems to be an event for each new coordinate, triggering this old bug. I feel a bit old now.
Oh, I missed lkd's comment that said the same thing. Now I feel old and silly.
Log in to post a comment.