MCPcopy Index your code
hub / github.com/csev/py4e / getMouse

Method getMouse

code/graphics/graphics.py:322–333  ·  view source on GitHub ↗

Wait for mouse click and return Point object representing the click. To get the last mouse click without waiting, use self.getLastMouse().

(self)

Source from the content-addressed store, hash-verified

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.

Callers 2

testFunction · 0.95
histogram.pyFile · 0.80

Calls 4

isClosedMethod · 0.95
toWorldMethod · 0.95
_tkCallFunction · 0.85
PointClass · 0.85

Tested by

no test coverage detected