Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8071921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:50:36+00:00 2026-06-05T13:50:36+00:00

I’m having a little trouble trying to get WarpPointer to work out appropriately for

  • 0

I’m having a little trouble trying to get WarpPointer to work out appropriately for me. The scenario I’m trying to do is akin to recording a user’s clicks and then replaying them on the screen. I’ve been able to record the screen motions and clicks without any issues; however, I’m stumbling when it comes to replaying what the user recorded.

def MoveCursorAndClick(self, e):
    # get the current screen position
    sp = self.GetPosition()
    p = self.getNextPosition() # returned in absolute x,y from screen rec
    self.WarpPointer(p.x - sp[0], p.y - sp[1])
    # wx.PostEvent(EVT_LEFT_DOWN, self.GetId())

Obviously, the above code is incorrect because WarpPointer appears to work within the window only and not the full screen. Attempting to base the coordinated off of the functioning window as well proves to be troublesome because they always seem to be off in the Y direction by about 50 pix. My only current assumption is I’m making this harder than it needs to be and there’s a better why I’m not seeing due to my inexperience with wxpython.

Additionally, the busted PostEvent line is the only thing I’ve managed to google across that looks like the right thing for sending a mouse click to something that may or may not be another window. Is that even the right direction?

Updated
As mentioned below, there’s not a good cross platform way to accomplish this. Here’s what I did (found various places on the internet):

def ClickScreenPositon(self, x, y):
    win32api.SetCursorPos((x,y))
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:50:39+00:00Added an answer on June 5, 2026 at 1:50 pm

    I don’t think you can do this in wxPython alone. wx.Window.WarpPointer() can only move the mouse to an area controlled by that window, as you’ve discovered. Similarly, you’re wx.EVT_LEFT_DOWN call won’t work because you’re setting the ID to the window, meaning it’s the window that was clicked, not a click at (x,y).

    After some light Googling and I found this article on Unit Testing in wxPython that breifly talks about testing at the GUI level. This isn’t exactly what you’re trying to do, but it is conceptually similiar. They suggest using an external library to manipulate the interface. The main problem they note about this approach is that most of the tools for simulation GUI interaction are under corporate licenses and/or platform dependent.

    That article suggests using pywinauto for Windows systems. For your purposes, pywinauto.controls.HwndWrapper seems to have the methods you require; MoveMouse() and Click(). If you aren’t using Windows or if you need cross-platform support you will need to research different libraries.

    Basically, you will need to install and import pywinauto into your wxPython application and call its methods instead of wxPython’s. As long as cross-platform compatibility is not an issue I think this is your simplest, best solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.