1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Rep Power

    Simple wxPython Question

    I've looked at a part of the wxPython demo which shows the position of the mouse when it is clicked, "Process and Events -> PythonEvents", and I'm confused about why it can't be simpler.

    So I was wondering if anybody could show me the simplest code to show the position of the mouse when it is clicked somewhere.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    London, England
    Rep Power
    You can get the position of the mouse pointer at any time using wxGetMousePosition(). If you want to continuously display the coords then call this function at regular intervals.

    You say you want to get the position of the mouse when it is clicked. If you mean when it is clicked on a control or window that you are handling yourself then it is easy - just call wxGetMousePosition() in the event handler.

    If you want to catch click anywhere on the screen then I don't know if it is possible in wxPython.

    Dave - The Developers' Coach

IMN logo majestic logo threadwatch logo seochat tools logo