(self, event)
| 245 | self.cnt += 1 |
| 246 | |
| 247 | def on_key_press(self, event): |
| 248 | if event.key == '3': |
| 249 | self.res *= 5.0 |
| 250 | if event.key == '4': |
| 251 | self.res /= 5.0 |
| 252 | |
| 253 | if event.key == 'e': |
| 254 | self.pads[0].y += .1 |
| 255 | if self.pads[0].y > 1 - .3: |
| 256 | self.pads[0].y = 1 - .3 |
| 257 | if event.key == 'd': |
| 258 | self.pads[0].y -= .1 |
| 259 | if self.pads[0].y < -1: |
| 260 | self.pads[0].y = -1 |
| 261 | |
| 262 | if event.key == 'i': |
| 263 | self.pads[1].y += .1 |
| 264 | if self.pads[1].y > 1 - .3: |
| 265 | self.pads[1].y = 1 - .3 |
| 266 | if event.key == 'k': |
| 267 | self.pads[1].y -= .1 |
| 268 | if self.pads[1].y < -1: |
| 269 | self.pads[1].y = -1 |
| 270 | |
| 271 | if event.key == 'a': |
| 272 | self.pucks.append(Puck(self.puckdisp, |
| 273 | self.pads[randint(2)], |
| 274 | self.ax.bbox)) |
| 275 | if event.key == 'A' and len(self.pucks): |
| 276 | self.pucks.pop() |
| 277 | if event.key == ' ' and len(self.pucks): |
| 278 | self.pucks[0]._reset(self.pads[randint(2)]) |
| 279 | if event.key == '1': |
| 280 | for p in self.pucks: |
| 281 | p._slower() |
| 282 | if event.key == '2': |
| 283 | for p in self.pucks: |
| 284 | p._faster() |
| 285 | |
| 286 | if event.key == 'n': |
| 287 | self.distract = not self.distract |
| 288 | |
| 289 | if event.key == 'g': |
| 290 | self.on = not self.on |
| 291 | if event.key == 't': |
| 292 | self.inst = not self.inst |
| 293 | self.i.set_visible(not self.i.get_visible()) |
| 294 | self.background = None |
| 295 | self.canvas.draw_idle() |
| 296 | if event.key == 'q': |
| 297 | plt.close() |
| 298 | |
| 299 | |
| 300 | fig, ax = plt.subplots() |
nothing calls this directly
no test coverage detected