[Python.NET] implement System.Windows.Forms.IWin32Window
H.N.(HARRY) ZHANG
hnzhang at gmail.com
Wed Jul 23 22:57:36 CEST 2008
I'm trying to implement the interface of IWin32Window, so that when the UI
from PythonDotNet is created, I can set the owner.
Here is the code,
class WindowWrapper(System.Windows.Forms.IWin32Window):
def __init__(self, handle):
self._hwnd = handle
def Handle():
doc = "property foo's doc string"
def fget(self):
return self._hwnd
return locals()
Handle = property(**Handle())
However, when an instance of WindowWrapper gets created, I got the following
error---# TypeError: object does not implement IWin32Window #
Here is the code to create an instance of WindowWrapper
procs = System.Diagnostics.Process.GetProcessesByName("maya");
intPtr = procs[0].MainWindowHandle
self.winWrapper = WindowWrapper(intPtr)
It seems I am doing something wrong in class WindowWrapper...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20080723/552171ef/attachment.htm>
More information about the PythonDotNet
mailing list