Simulating Mouse Events

Back in 2006, Robin wrote (ウマトピ):

This is something I would like to see changed, but curretly wxWidgets doesn't support sending native events to the native widgets. So when you make an event instance and send it with ProcessEvent all that happens is that the event passes through the wx event system as if it had originated as a native event, but then when the event is not handled by any wx event handler the process is over. It doesn't continue on to the native widget like it would have if it was a real event.

The only way to do this currently is to use the native APIs to send the events or messages to the native widgets, but those APIs are not currently exposed by wxPython. There is however a Google Summer of Code project proposed that may be able to help make some changes in this area.

Has anything changed in this regard? Can this be done on the mac using PyObjC?

I have a wxPython app I wrote that is a browser for Pandora; I would like to be able to automatically send the browser a mouse click at an interval to keep it active. (Currently, Pandora checks every hour to make sure someone is still listening.) That way, I don't have to go downstairs and start the music again that's being streamed to the stereo upstairs... (yes, I know, lazy.)

thanks!

Hi John,

Back in 2006, Robin wrote (ウマトピ):

This is something I would like to see changed, but curretly wxWidgets doesn't support sending native events to the native widgets. So when you make an event instance and send it with ProcessEvent all that happens is that the event passes through the wx event system as if it had originated as a native event, but then when the event is not handled by any wx event handler the process is over. It doesn't continue on to the native widget like it would have if it was a real event.

The only way to do this currently is to use the native APIs to send the events or messages to the native widgets, but those APIs are not currently exposed by wxPython. There is however a Google Summer of Code project proposed that may be able to help make some changes in this area.

Has anything changed in this regard? Can this be done on the mac using PyObjC?

On Mac, this should work for you:

http://trac.wxwidgets.org/browser/sandbox/trunk/UIEventSim

You need Bakefile and Robin's Modified SWIG 1.3.29 (available from here: NameBright - Coming Soon) to get it going. It's only implemented for Mac right now (and the keyboard handling still is not yet working), but the mouse handling should work fine for you. See the tests subdir for how to use it.

Once the implementation is cleaned up and ported to Linux / Mac, we will make this part of wxPython so people won't need to build it or muck with it anymore. :wink:

Regards,

Kevin

···

On Jan 26, 2009, at 2:32 PM, John Jackson wrote:

I have a wxPython app I wrote that is a browser for Pandora; I would like to be able to automatically send the browser a mouse click at an interval to keep it active. (Currently, Pandora checks every hour to make sure someone is still listening.) That way, I don't have to go downstairs and start the music again that's being streamed to the stereo upstairs... (yes, I know, lazy.)

thanks!
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Hi Kevin,

So I downloaded all these parts, looked over the code, and dug in. I installed Robin's SWIG and Bakefile.

Bakefile ended up in /usr/local/bin/bakefile, not /usr/share/bakefile, so I modified build-eventsim.py accordingly.

However, when I import wx.build.config, I get a series of messages:

>>> import wx.build.config
ls: wx*-2.4-config: No such file or directory

   Warning: No config found to match: /usr/bin/wx-config --toolkit=mac --unicode=yes --version=2.8 --cxxflags
            in /usr/lib/wx/config
   If you require this configuration, please install the desired
   library build. If this is part of an automated configuration
   test and no other errors occur, you may safely ignore it.
   You may use wx-config --list to see all configs available in
   the default prefix.

Plus, when I run python build-eventsim.py, after all theses error messages (generated when wx.build.config is imported), it eventually craps out with

no changes in GNUmakefile
wxPyInclude: None
g++ -dynamiclib -fPIC -o libeventsim.dylib eventsim_UIEventSimulator.o eventsim_eventsim_mac.o -g `/usr/local/lib/wxPython-unicode-2.8.9.1/bin/wx-config --libs core,base`
ld: Undefined symbols:
__ZTI8wxThread
/usr/bin/libtool: internal link edit command failed
make: *** [libeventsim.dylib] Error 1

I'm using Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) with wxPython-unicode-2.8.9.1.

I googled __ZTI8wxThread and saw a few suggestions, including setting an environment variable such as WX_CONFIG=/usr/local/lib/wxPython-unicode-2.8.9.1/bin/wx-config
but that didn't help.

Is it looking for some source files that I don't have (or do have but it can't find?) I have downloaded the source tar, but I've never actually built wxPython from it...

···

On Jan 26, 2009, at 3:20 PM, Kevin Ollivier wrote:

Hi John,

On Jan 26, 2009, at 2:32 PM, John Jackson wrote:

Back in 2006, Robin wrote (ウマトピ):

This is something I would like to see changed, but curretly wxWidgets doesn't support sending native events to the native widgets. So when you make an event instance and send it with ProcessEvent all that happens is that the event passes through the wx event system as if it had originated as a native event, but then when the event is not handled by any wx event handler the process is over. It doesn't continue on to the native widget like it would have if it was a real event.

The only way to do this currently is to use the native APIs to send the events or messages to the native widgets, but those APIs are not currently exposed by wxPython. There is however a Google Summer of Code project proposed that may be able to help make some changes in this area.

Has anything changed in this regard? Can this be done on the mac using PyObjC?

On Mac, this should work for you:

wxTrac has been migrated to GitHub Issues - wxWidgets

You need Bakefile and Robin's Modified SWIG 1.3.29 (available from here: NameBright - Coming Soon) to get it going. It's only implemented for Mac right now (and the keyboard handling still is not yet working), but the mouse handling should work fine for you. See the tests subdir for how to use it.

Once the implementation is cleaned up and ported to Linux / Mac, we will make this part of wxPython so people won't need to build it or muck with it anymore. :wink:

Regards,

Kevin

I have a wxPython app I wrote that is a browser for Pandora; I would like to be able to automatically send the browser a mouse click at an interval to keep it active. (Currently, Pandora checks every hour to make sure someone is still listening.) That way, I don't have to go downstairs and start the music again that's being streamed to the stereo upstairs... (yes, I know, lazy.)

thanks!
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

John Jackson wrote:

However, when I import wx.build.config, I get a series of messages:

>>> import wx.build.config
ls: wx*-2.4-config: No such file or directory

are you on OS-X?

If so:

1) Apple provides a version of wx with the system -- it looks like you are getting the 2.4 wx-config -- you need to run the wx-config that your build of wx (2.8) produces. There must be a way to set this somewhere.

messages (generated when wx.build.config is imported), it eventually craps out with

ld: Undefined symbols:
__ZTI8wxThread

I think this looks familiar -- Robin will no better, but:

I believe the Universal binary of wxPython was built by using an older SDK for the PPC build, and a newer one for the Intel build, then the two are lipo'd together. I think __ZTI8wxThread is a symbol that is on the newer Intel sdk, but not the older PPC one.

If you're on a PPC, you'll need to set some environment variables to get it to build right -- sorry, I'm at home now and Mac-less so I can't tell you more of what to do.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:

John Jackson wrote:

However, when I import wx.build.config, I get a series of messages:

>>> import wx.build.config
ls: wx*-2.4-config: No such file or directory

are you on OS-X?

If so:

1) Apple provides a version of wx with the system -- it looks like you are getting the 2.4 wx-config -- you need to run the wx-config that your build of wx (2.8) produces. There must be a way to set this somewhere.

You can pass a WX_CONFIG=pathname parameter on the setup.py command line to tell it which one to use. Or just make sure that the newer wx-config is found first on the PATH.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!