Displaying windows generated with wxPython through another GUI system

Hi everybody,

The wx.lib.activex library is very useful to display an ActiveX control in a wxPython window. The ActiveX control generates in the background a window handle, a.k.a HWND, which is displayed through the wxPython application.

I’d like to know if the opposite situation is possible. Can wxPython generate in the background a set of windows having specific HWND that can be piped to another program using a different GUI system like Qt or WPF ?

Regards,

Thierry BRIZZI.

Thierry Brizzi wrote:

The wx.lib.activex library is very useful to display an ActiveX
control in a wxPython window. The ActiveX control generates in the
background a window handle, a.k.a HWND, which is displayed through
the wxPython application.

I'd like to know if the opposite situation is possible. Can wxPython
generate in the background a set of windows having specific HWND that
can be piped to another program using a different GUI system like Qt
or WPF ?

Those are entirely different situations. Your ActiveX control is a DLL
within your process. It shares your memory, and it's windows are
registered in your process so that messages get dispatched from your
message loop. So, you can't have a wxPython program in one process that
injects an HWND into another process.

However, at the bottom level, both Qt and WPF have an ordinary Windows
message loop at the bottom. So, theoretically, you could have a Python
DLL that gets called from a Qt application and creates a wxPython
window. The Qt mainloop should theoretically be able to route messages
to the wx window procedure, which should be able to fire event callbacks
in your Python code.

I'm dubious that it would actually work.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

It might be possible with the win32gui library:
http://docs.activestate.com/activepython/2.4/pywin32/win32gui.html

I was able to use it to capture windows from new processes I had spawned in my wxPython GUI, and attach those windows to my GUI (like an MDI child of my GUI). I assume the reverse would be limited by the facilities provided in the processes you wish to ‘pipe’ to. You can get the HWND of the wxPython windows, so you should be able to copy-paste/write-to-file that ID and use it to do stuff from the other process. The other process would have to have some API for passing an HWND in.

win32gui might also allow you to do the re-parenting stuff in the backwards manner, i.e. making your wxPython window an MDI child of the other process/window. Not saying you want MDI stuff, but just as an example. I don’t know if this will work for sure, but it seemed like it might from my limited experience playing with win32gui code.

···

On Wednesday, September 3, 2014 6:37:45 AM UTC-7, Thierry Brizzi wrote:

Hi everybody,

The wx.lib.activex library is very useful to display an ActiveX control in a wxPython window. The ActiveX control generates in the background a window handle, a.k.a HWND, which is displayed through the wxPython application.

I’d like to know if the opposite situation is possible. Can wxPython generate in the background a set of windows having specific HWND that can be piped to another program using a different GUI system like Qt or WPF ?

Regards,

Thierry BRIZZI.

It will be difficult to start from scratch with pywin32 and MDI. Can you provide an example to put this in practice ?

Cheers.