1 #连续点击10次鼠标返回坐标值 2 3 from graphics import * 4 def main(): 5 win=GraphWin("Click me!") 6 for i in range(10): 7 p=win.getMouse() 8 print("You clicked at:",p.getX(),p.getY()) 9 if __name__=='__main__': 10 main()
运行结果如下: