Wait for mouse click and return Point object representing the click. To get the last mouse click without waiting, use self.getLastMouse().
(self)
| 320 | _tkCall(self.update_idletasks) |
| 321 | |
| 322 | def getMouse(self): |
| 323 | """Wait for mouse click and return Point object representing |
| 324 | the click. |
| 325 | To get the last mouse click without waiting, use self.getLastMouse().""" |
| 326 | self.mouseX = None |
| 327 | self.mouseY = None |
| 328 | while self.mouseX == None or self.mouseY == None: |
| 329 | _tkCall(self.update) |
| 330 | if self.isClosed(): raise GraphicsError, "getMouse in closed window" |
| 331 | time.sleep(.1) # give up thread |
| 332 | x,y = self.toWorld(self.mouseX, self.mouseY) |
| 333 | return Point(x,y) |
| 334 | |
| 335 | def getLastMouse(self): |
| 336 | """Return last mouse click Point without waiting for the next click. |