File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,39 +130,37 @@ def motion(self, ev):
130130 start = self .time ,
131131 stop = ev .time )
132132
133- if not r .events :
134- return
135-
136133 # Record the previous last coordinate, and append
137134 # the new coordinates
138135
139136 firstline = len (self .lines ) - 1
140137
141- # Discard the first coordinate if that is identical to
142- # the last recorded coordinate
138+ if r .events :
139+ # Discard the first coordinate if that is identical to
140+ # the last recorded coordinate
143141
144- pos = r .events [0 ]
145- if (pos .x , pos .y ) == self .lines [- 1 ]:
146- events = r .events [1 :]
147- else :
148- events = r .events
142+ pos = r .events [0 ]
143+ if (pos .x , pos .y ) == self .lines [- 1 ]:
144+ events = r .events [1 :]
145+ else :
146+ events = r .events
149147
150- # Append all coordinates
151- for pos in events :
152- x = pos .x
153- y = pos .y
148+ # Append all coordinates
149+ for pos in events :
150+ x = pos .x
151+ y = pos .y
154152
155- if x < self .left :
156- self .left = x
157- if x > self .right :
158- self .right = x
153+ if x < self .left :
154+ self .left = x
155+ if x > self .right :
156+ self .right = x
159157
160- if y < self .top :
161- self .top = y
162- if y > self .bottom :
163- self .bottom = y
158+ if y < self .top :
159+ self .top = y
160+ if y > self .bottom :
161+ self .bottom = y
164162
165- self .lines .append ((x , y ))
163+ self .lines .append ((x , y ))
166164
167165 # Append the event coordinate, if that is different from the
168166 # last movement coordinate
Original file line number Diff line number Diff line change @@ -137,38 +137,36 @@ def motion(self, ev):
137137 # last event received
138138
139139 events = self .win .window .get_motion_events (self .time , ev .time )
140-
141- if not events :
142- return
140+ self .time = ev .time
143141
144142 # Record the previous last coordinate, and append
145143 # the new coordinates
146-
147144 firstline = len (self .lines ) - 1
148145
149- # Discard the first coordinate if that is identical to
150- # the last recorded coordinate
146+ if events :
147+ # Discard the first coordinate if that is identical to
148+ # the last recorded coordinate
151149
152- pos = events [0 ]
153- if (pos .x , pos .y ) == self .lines [- 1 ]:
154- events = events [1 :]
150+ pos = events [0 ]
151+ if (pos .x , pos .y ) == self .lines [- 1 ]:
152+ events = events [1 :]
155153
156- # Append all coordinates
157- for pos in events :
158- x = pos .x
159- y = pos .y
154+ # Append all coordinates
155+ for pos in events :
156+ x = pos .x
157+ y = pos .y
160158
161- if x < self .left :
162- self .left = x
163- if x > self .right :
164- self .right = x
159+ if x < self .left :
160+ self .left = x
161+ if x > self .right :
162+ self .right = x
165163
166- if y < self .top :
167- self .top = y
168- if y > self .bottom :
169- self .bottom = y
164+ if y < self .top :
165+ self .top = y
166+ if y > self .bottom :
167+ self .bottom = y
170168
171- self .lines .append ((x , y ))
169+ self .lines .append ((x , y ))
172170
173171 # Append the event coordinate, if that is different from the
174172 # last movement coordinate
@@ -180,7 +178,6 @@ def motion(self, ev):
180178 X .CoordModeOrigin ,
181179 self .lines [firstline :])
182180
183- self .time = ev .time
184181
185182 def finish (self , ev ):
186183 self .motion (ev )
You can’t perform that action at this time.
0 commit comments