Windows - getting Tkinter or wxPython window handle? 
Author Message
 Windows - getting Tkinter or wxPython window handle?

On Windows, is there any chance of getting hold of an
MFC window handle for a Tkinter or wxPython window?
If so, how?

(I'm investigating the feasibility of wrapping a library
which needs such a handle.)

Thanks,

--
Greg Ewing, Computer Science Dept,
University of Canterbury,      
Christchurch, New Zealand
http://www.*-*-*.com/ ~greg



Fri, 09 Dec 2005 10:51:04 GMT  
 Windows - getting Tkinter or wxPython window handle?

Quote:
> On Windows, is there any chance of getting hold of an
> MFC window handle for a Tkinter or wxPython window?
> If so, how?

 > On Windows, is there any chance of getting hold of an
 > MFC window handle for a Tkinter or wxPython window?
 > If so, how?

wxWindow and its descendants have a GetHandle method.

"""
wxWindow::GetHandle
void* GetHandle() const

Returns the platform-specific handle of the physical window. Cast it to
an appropriate handle, such as HWND for Windows, Widget for Motif or
GtkWidget for GTK.

wxPython note: This method will return an integer in wxPython.
"""  -- extract from wxPython helpfile, Julian Smart, Robert Roebling,
Vadim Zeitlin, Robin Dunn, et al

Within Tkinter, there is apparently an inner and outer window:

"""
you should be able to use wm_frame() (aka frame()) to
get hold of the outer window:

     inner = w.winfo_id()
     outer = string.atoi(w.wm_frame(), 0)

(wm_frame() returns the handle as a hex string).

Note that if the window hasn't been reparented by the
"window manager", both methods return the same window
handle.
""" -- extract from a posting by Fredrik Lundh

I hope this what you were after (I'm not familiar with "MFC handles")

Regards, Myles.



Fri, 09 Dec 2005 12:00:40 GMT  
 Windows - getting Tkinter or wxPython window handle?

Quote:
> On Windows, is there any chance of getting hold of an
> MFC window handle for a Tkinter or wxPython window?
> If so, how?

In wxPython, wxWindows have a method called GetHandle which will
return the HWND of the window.


Fri, 09 Dec 2005 14:30:34 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. getting window handle (MS Windows) from PPST

2. Can Tkinter handle arbitrary Windows messages?

3. Getting window handle of AXControlSite

4. Getting the Window Handle in VW2.5

5. standard deployment for wxPython on Windows? (fwd)

6. wxPython 0.3 MS-Windows binary release is available

7. wxPython: Popped-up widget not refreshed properly on Windows

8. wxPython crashing windows

9. Tkinter - getting canvas window size

10. ANNOUNCE: Helga - ODBC,CGI,Tcl,Windows NT,Windows 95,MS Windows

11. Windows Handles in SmallTalk...HELP!!!

12. Windows and handles

 

 
Powered by phpBB® Forum Software