How do I get the x coords to show up after mouse click? - Python
Question: I'm trying to figure out how to get the x coords to show up when the user
clicks a point in the graphics window. Any ideas? Thanks!

Here's my code:

**Set graphics window**

    
    
    win = GraphWin("Uncle Scrooges Money Bin", 640,480)
    win.setCoords(0,0,80,60)
    win.setBackground("white")
    

**Get coordinate of mouse click 1**

    
    
    point1 = win.getMouse() #*****************************
    

**Display coordinates of point 1**

    
    
    print("Point 1 coordinates: ", point1)
    


Answer: It would be easier to do what you say using `Tkinter` library.

    
    
    import Tkinter
    
    def mouse(event):
        print "Point 1 coordinate :",event.x,event.y
    # event parameter will be passed to the function when the mouse is clicked
    # This parameter also contains co-ordinates of where the mouse was clicked 
    # which can be accessed by event.x and event.y
    
    win = Tkinter.Tk()  # Main top-level window
    
    win.title("Uncle Scrooges Money Bin")  
    win.geometry("640x480+80+60")  # Set window diensions
    
    frame = Tkinter.Frame(win, background='white', width=640, height=480)  
    # New frame to handle mouse-clicks
    
    frame.pack()  # pack frame(or make frame visible)
    frame.bind('<Button-1>', mouse)  
    # Bind mouse-click event denoted by '<Button-1>' to mouse function 
    
    win.mainloop()  # Start window main loop
    

