Help with spawning and managing a subprocess from within Python/wx

My wxPython application runs on a Linux machine. I
need to spawn a Windows only program, using wine after the user clicks a button
in my application. I have gotten this to work using python’s
builtin subprocess module, and have also gotten it to work using
wx.Execute/wx.Process modules. However, my problem comes from the fact
that my application runs fullscreen. If the user clicks the button again,
I need to be able to pop the wine’d application to the front rather than
open another process. I have not been able to figure out how to send an
event to the Window manager to bring this window to the front. Does
anyone have any suggestions on how to do this via either python/wxPython?

Thanks,

Jason

Jason K. Ergle escribió:

that my application runs fullscreen. If the user clicks the button again, I need to be able to pop the wine’d application to the front rather than open another process. I have not been able to figure out how to send an event to the Window manager to bring this window to the front. Does anyone have any suggestions on how to do this via either python/wxPython?

Hi Jason,

I think you can do this changing the state of the window of the wine'd process with the xprop [1] command, using python-xlib bindings [2], or using the wnck module from pygtk for example [3] (which has the downside of depending on GTK and not only X11). Wnck has bindings for python [4], which you get for free with the python-gnome2-desktop package in Ubuntu; here is an example [5].

[1] XPROP(1) manual page
[2] http://python-xlib.sourceforge.net/
[3] http://svn.gnome.org/viewvc/libwnck/trunk/
[4] http://svn.gnome.org/viewvc/gnome-python-desktop/trunk/wnck/
[5] http://svn.gnome.org/viewvc/gnome-python-desktop/trunk/examples/wnck_example.py?view=markup

The thing is you can get the child window XID having previously the PID (Process ID), so it should be possible to do it. Once you have the XID, it should be easy to send the message you want to the window. I think you can do it low-level (using xprox/xlib) or "high-level" with wnck.

I hope you can get it working, and post here the answer (why not?) :slight_smile:

Regards,
Marcelo

···

--
Marcelo F. Fernández
Buenos Aires, Argentina
Licenciado en Sistemas - CCNA

E-Mail: fernandezm22@yahoo.com.ar
Jabber ID: fernandezm22@jabber.org
Public Key ID: 5C990A6C 111C3661
Blog: http://marcelosoft.blogspot.com